# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066777 | 2024-08-20T06:57:37 Z | 정민찬(#11123) | Present (RMI21_present) | C++17 | 4000 ms | 344 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; vector<int> v; int G[101][101]; int chk[101]; int cnt = 0; const int lim = 5e8 + 10; const int split = 1e7; vector<pair<vector<int>,int>> save; int go(int p) { if (cnt > lim) return 0; int lo = 0; for (int i=p-1; i>=1; i--) { if (chk[i]) { lo = i; break; } } int prv = cnt; if (!lo) { cnt ++; } lo = max(1, lo); vector<int> ch; for (int i=lo; i<p; i++) { for (auto &j : v) { chk[G[i][j]] ++; } v.push_back(i); ch.push_back(go(i)); v.pop_back(); for (auto &j : v) { chk[G[i][j]] --; } } if (cnt - prv > split) { for (int i=lo; i<p; i++) { if (ch[i-lo] <= split) { v.push_back(i); save.push_back({v, ch[i-lo]}); v.pop_back(); } } } return cnt - prv; } int main() { //ios_base :: sync_with_stdio(false); cin.tie(NULL); for (int i=1; i<=100; i++) { for (int j=1; j<=100; j++) { G[i][j] = __gcd(i, j); } } go(101); cout << "done\n"; cout << save.size() << '\n'; sort(save.begin(), save.end()); for (auto &[vec, x] : save) { cout << "{{"; for (int i=0; i<vec.size(); i++) { cout << vec[i]; if (i + 1 != vec.size()) cout << ','; } cout << "}," << x << "},"; } /*int T; cin >> T; while (T --) { int x; cin >> x; cout << save[x].size() << ' '; if (x) { for (int i=save[x].size()-1; i>=0; i--) { cout << save[x][i] << ' '; } } cout << '\n'; }*/ }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |