# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041811 | 2024-08-02T08:28:31 Z | GEN(#11054) | A Light Inconvenience (CEOI23_light) | C++17 | 1000 ms | 1048576 KB |
#include "light.h" #include <vector> using namespace std; #include <bits/stdc++.h> #define int long long int N = 1; vector<int> V; void prepare(){ N = 1; V.clear(); V.push_back(1); } /* 1557 -1 -> error */ std::pair<long long, std::vector<long long>> join(long long p){ N += p; vector<int> V2; int i, j; int c = N; while(true) { //cout << c << '\n'; if(c==1) { V2.push_back(c); break; } int val = N; for(int i=V.size()-1;i>=0;i--) { int n = V[i]; if(n <= c && c <= n+p) val = c; if(n < c-p) break; } if(val != c) { for(i=V.size()-1;i>=0;i--) { int n = V[i]; if(n >= c) { val = min(val, n); break; } if(n < c) break; } } c = val; V2.push_back(c); c = max(1LL, 2*(c-1)-N); } reverse(V2.begin(),V2.end()); V = V2; return {p, V}; } std::pair<long long, std::vector<long long>> leave(long long p){ N -= p; int c = N; vector<int> V2; int i, j; while(true) { //cout << c << '\n'; if(c==1) { V2.push_back(c); break; } int val = N; for(int i=V.size()-1;i>=0;i--) { int n = V[i]; if(n <= c && c <= n+p) val = c; if(n < c-p) break; } if(val != c) { for(i=V.size()-1;i>=0;i--) { int n = V[i]; if(n >= c) { val = min(val, n); } if(n < c) break; } } c = val; V2.push_back(c); c = max(1LL, 2*(c-1)-N); } reverse(V2.begin(),V2.end()); V = V2; return {p, V}; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Correct | 326 ms | 344 KB | Correct |
3 | Correct | 344 ms | 428 KB | Correct |
4 | Correct | 325 ms | 600 KB | Correct |
5 | Correct | 366 ms | 344 KB | Correct |
6 | Correct | 335 ms | 416 KB | Correct |
7 | Correct | 311 ms | 420 KB | Correct |
8 | Execution timed out | 2357 ms | 1048576 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Runtime error | 934 ms | 1048576 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Runtime error | 934 ms | 1048576 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Runtime error | 934 ms | 1048576 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Runtime error | 934 ms | 1048576 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Correct |
2 | Runtime error | 934 ms | 1048576 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Correct |
2 | Correct | 307 ms | 428 KB | Correct |
3 | Correct | 320 ms | 344 KB | Correct |
4 | Correct | 344 ms | 440 KB | Correct |
5 | Correct | 303 ms | 344 KB | Correct |
6 | Correct | 339 ms | 592 KB | Correct |
7 | Correct | 329 ms | 344 KB | Correct |
8 | Execution timed out | 2450 ms | 1048576 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |