# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
442817 | 2021-07-09T07:52:01 Z | ivandasfs | Sob (COCI19_sob) | C++14 | 75 ms | 6308 KB |
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #include <queue> #include <map> #include <set> using namespace std; #define mp make_pair #define pb push_back #define x first #define y second typedef long long ll; const ll INF = 1e9+5; const ll MOD = 1e9+7; vector <int> b; int main() { int n, m; scanf("%d%d", &n, &m); for (int i=m ; i<n+m ; i++) { b.pb(i); } int l = 0; for (int i=20 ; i>=0 ; i--) { int p = (1<<i); if (n >= p) { // cout <<"p = "<<p<<endl; int st = 0; int cnt = 0; for (int j=0 ; j<b.size() ; j++) { if ((b[j]&p) == 0) { cnt++; if (cnt == p) { st = j - p + 1; break; } } else cnt = 0; } if (cnt == p) { // cout <<"A\n"; for (int j=0 ; j<p ; j++) { printf("%d %d\n", l, b[st+j]); l++; } vector <int> nb; for (int j=0 ; j<b.size() ; j++) { if (j<st or j>=st+p) nb.pb(b[j]); } b = nb; } else { // cout <<"B\n"; cnt = 0; for (int j=0 ; j<b.size() ; j++) { if (b[j] % p == 0) st = j; } if (b[b.size()-1] & p) st = b.size(); for (int j=st ; j<b.size() ; j++) { printf("%d %d\n", l, b[j]); l++; cnt++; } int pos; for (int j=0 ; j<st ; j++) { if (b[j]%p == l%p) pos = j; } while (b[pos]%p != b[0]%p) { printf("%d %d\n", l, b[pos]); l++; cnt++; pos++; } int j = 0; for ( ; cnt<p ; j++) { printf("%d %d\n", l, b[j]); l++; cnt++; } vector <int> nb; for (j=pos ; j<st ; j++) nb.pb(b[j]); for (j++ ; j<pos ; j++) nb.pb(b[j]); b = nb; } n -= p; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Runtime error | 54 ms | 5548 KB | Execution killed with signal 11 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 75 ms | 6308 KB | Output is correct |
7 | Correct | 30 ms | 2640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 288 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Runtime error | 54 ms | 5548 KB | Execution killed with signal 11 |