# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
595887 | 2022-07-14T07:52:48 Z | AGE | Sob (COCI19_sob) | C++14 | 424 ms | 8340 KB |
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N=2e6+10,M=2e3,mod=10; bool vis[N]; main() { int n,m; cin>>n>>m; int cnt=0; for(int i=0;i<30;i++){ if(((n+m)&(1<<i))) cnt++; } if(cnt==1){ vector<pair<int,int>>v; for(int i=m;i<n+m;i++){ bitset<32>bt; int num=0; bt=i; for(int j=0;j<31;j++){ if(bt[j]==1){ num+=(1<<j); if(vis[num]==0){ vis[num]=1; break; } } } if(num==n){ num=0; } v.pb({num,i}); } sort(v.begin(),v.end()); for(int i=0;i<v.size();i++) cout<<v[i].F<<" "<<v[i].S<<endl; } else{ int index=-1; for(int i=m+n-1;i>=m;i--){ int y=n-1; int x=(i&y); if(x==y){ index=i; break; } } int indexx=index+1; int i=n-1; while(i>-1){ cout<<i<<" "<<index<<endl; i--; index--; if(index==m-1) index=m+n-1; } if(i!=-1) cout<<i<<" "<<indexx<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 390 ms | 3848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 468 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 424 ms | 8340 KB | Output is correct |
7 | Correct | 215 ms | 4172 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 304 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 390 ms | 3848 KB | Output is correct |
5 | Correct | 6 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 304 KB | Output is correct |
10 | Correct | 424 ms | 8340 KB | Output is correct |
11 | Correct | 215 ms | 4172 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Incorrect | 1 ms | 304 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |