Submission #748491

# Submission time Handle Problem Language Result Execution time Memory
748491 2023-05-26T11:09:08 Z Trunkty Sob (COCI19_sob) C++14
39 / 110
130 ms 143280 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

int n,m,l,r,curr;
vector<vector<int>> ans;
vector<int> a;
vector<int> b[3000005];

signed main(){
    //ios::sync_with_stdio(false);
    //cin.tie(NULL);
    cin >> n >> m;
    for(int i=0;i<=n-1;i++){
        a.push_back(i);
    }
    for(int i=m;i<=m+n-1;i++){
        b[i].push_back(i);
    }
    for(int j=20;j>=0;j--){
        while(a.size()>0 and a.back()&(1<<j)){
            int x = a.back();
            a.pop_back();
            int y = b[x].back();
            b[x].pop_back();
            ans.push_back({x,y});
        }
        for(int i=(1<<j);i<(1<<(j+1));i++){
            for(int k:b[i]){
                b[i-(1<<j)].push_back(k);
            }
            b[i].clear();
        }
    }
    ans.push_back({a.back(),b[0][0]});
    for(vector<int> i:ans){
        cout << i[0] << " " << i[1] << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 70860 KB Output is correct
2 Correct 39 ms 70736 KB Output is correct
3 Correct 37 ms 70680 KB Output is correct
4 Correct 129 ms 113780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 71116 KB Output is correct
2 Correct 42 ms 70764 KB Output is correct
3 Correct 40 ms 70748 KB Output is correct
4 Correct 41 ms 70648 KB Output is correct
5 Correct 40 ms 70816 KB Output is correct
6 Correct 130 ms 107144 KB Output is correct
7 Correct 93 ms 92280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 70696 KB Output is correct
2 Runtime error 98 ms 143280 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 70860 KB Output is correct
2 Correct 39 ms 70736 KB Output is correct
3 Correct 37 ms 70680 KB Output is correct
4 Correct 129 ms 113780 KB Output is correct
5 Correct 42 ms 71116 KB Output is correct
6 Correct 42 ms 70764 KB Output is correct
7 Correct 40 ms 70748 KB Output is correct
8 Correct 41 ms 70648 KB Output is correct
9 Correct 40 ms 70816 KB Output is correct
10 Correct 130 ms 107144 KB Output is correct
11 Correct 93 ms 92280 KB Output is correct
12 Correct 39 ms 70696 KB Output is correct
13 Runtime error 98 ms 143280 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -