Submission #765019

# Submission time Handle Problem Language Result Execution time Memory
765019 2023-06-24T07:38:30 Z 1075508020060209tc Sob (COCI19_sob) C++14
110 / 110
542 ms 9108 KB

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define X first
#define Y second
int n;int m;
int vis[1000006];

signed main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
vector<pair<int,int>>ans;
cin>>n>>m;
int lst=0;
for(int i=n-1;i>=0;i--){
    if(lst!=0&&vis[lst-1]==0&&((i&(lst-1+m))==i)  ){
        lst--;
        //ans.push_back({i,lst+m});
        cout<<i<<" "<<lst+m<<endl;
        vis[lst]=1;
        continue;
    }
    for(int j=0;j<=n-1;j++){
        if(vis[j]){continue;}
        if( ((i&(j+m))==i)  ){
            cout<<i<<" "<<j+m<<endl;
            lst=j;
            vis[j]=1;
            break;
        }
    }
}

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 289 ms 4920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 288 ms 4948 KB Output is correct
7 Correct 138 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 289 ms 4920 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 288 ms 4948 KB Output is correct
11 Correct 138 ms 2392 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 59 ms 1228 KB Output is correct
20 Correct 213 ms 3728 KB Output is correct
21 Correct 8 ms 340 KB Output is correct
22 Correct 4 ms 340 KB Output is correct
23 Correct 303 ms 5188 KB Output is correct
24 Correct 536 ms 9108 KB Output is correct
25 Correct 542 ms 9036 KB Output is correct