Submission #235597

# Submission time Handle Problem Language Result Execution time Memory
235597 2020-05-28T18:30:15 Z doowey Sob (COCI19_sob) C++14
0 / 110
1000 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 505;
int cnt[N];
bool ban[N];
bool use[N];

int main(){
  fastIO;
  int n, m;
  cin >> n >> m;
  for(int i = 0 ; i < n; i ++ ){
    for(int j = 0 ; j < n; j ++){
      if((i & (m + j)) == i) cnt[i] ++ ;
    }
  }
  int low;
  for(int sol = 0; sol < n ; sol ++ ){
    low = -1;
    for(int i = 0 ; i < n ; i ++ ){
      if(ban[i]) continue;
      if(low == -1 || cnt[i] < cnt[low]){
        low = i;
      }
    }
    if(cnt[low] == 0){
      assert(0);
      return 0;
    }
    for(int j = 0 ; j < n; j ++ ){
      if(use[j]) continue;
      if((low & (m + j)) == low){
        cout << low << " " << m + j << "\n"; 
        use[j]=true;
        ban[low]=true;
        for(int x = 0; x < n; x ++ ){
          if((x & (m + j)) == x)
            cnt[x]--;
        }
        break;
      }
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Execution timed out 1087 ms 384 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Execution timed out 1087 ms 384 KB Time limit exceeded