Submission #496028

# Submission time Handle Problem Language Result Execution time Memory
496028 2021-12-20T12:34:58 Z asandikci Sob (COCI19_sob) C++17
0 / 110
76 ms 7884 KB
#include"iostream"
#include"vector"
// #include"queue"
// #include"deque"
// #include"set"
// #include"map"
#include"algorithm"
// #include"iomanip"
#include"cstring"
#include"cmath"
#include"bitset"
#define int long long
using namespace std;  

void solve(){
  int n,k;
  cin >> n >> k;
  int til = ceil(log2(n)); //+1 maybe
  // cout << til << "\n";
  int num;
  bitset<16> bt;
  vector<pair<int,int>> vec;
  for(int i=k;i<k+n;i++){
    bt = i;
    num=0;
    for(int j=0;j<til;j++){
      if(bt[j]==1){
        num+=(1<<j);
      }
    }
    if(num==n){num=0;}
    vec.push_back({num,i});
    // cout << num << "\n";
  }
  sort(vec.begin(),vec.end());
  for(auto it : vec){
    cout << it.first << " " << it.second << "\n";
  }
}

signed main(){
  // ios::sync_with_stdio(false); cin.tie(0);
  // freopen("","r",stdin);freopen("","w",stdout);
  int t=1;
  // cin >> t;
  for(int i=1;i<=t;i++){
    // cout << "Case " << i << ":\n";
    solve();
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 76 ms 7884 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Integer parameter [name=x] equals to 3378, violates the range [0, 3376]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Integer parameter [name=x] equals to 13, violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 76 ms 7884 KB Output isn't correct