#include<bits/stdc++.h> usingnamespace std; using i128 = __int128; intmain() { // GNU C++11: Array array<int, 3> C = {1, 2, 3}; for (int i : C) { cout << i << " "; } //test 64bit i128 tmp = 0; tmp++; cout << endl; // GNU C++14: Recursive lambda with auto auto dfs = [&](auto self, int x) -> void { if (x > 10) return; cout << "DFS at x = " << x << endl; self(self, x + 1); }; dfs(dfs, 1); // GNU C++17: Template argument deduction for vector vector in(2, vector<int>(2, 1)); for (auto x : in) { for (auto y : x) { cout << y << " "; } cout << endl; }
// GNU C++17: Structured bindings map<int, int> dic = {{1, 2}, {3, 4}}; for (auto [u, v] : dic) { cout << "{" << u << ", " << v << "} "; } cout << endl; // GNU C++20: contains method for map if (dic.contains(1)) { cout << "contains" << endl; } else { cout << "not contain" << endl; } return0; }
2.速度测试:8e9级别
Atocder:不开优化874 ms,开优化875 ms.
n开到5000Atocder:不开优化874 ms,开优化875 ms.
Codeforcs:不开优化ms,开优化 ms
Qoj:不开优化 4347ms,开优化1734ms
注意一个事:如果n开到5000.。Atocder:不开优化8348 ms,开优化1696ms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// #pragma GCC optimize("Ofast", "unroll-loops") #include<bits/stdc++.h> usingnamespace std; signedmain(){ int n = 4E3; bitset<30> ans; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j += 2) { for (int k = 1; k <= n; k += 4) { ans |= i | j | k; } } } cout << ans.to_ullong() << "\n"; }