Submission #209651

# Submission time Handle Problem Language Result Execution time Memory
209651 2020-03-15T03:00:53 Z EntityIT None (JOI16_memory2) C++14
60 / 100
5 ms 376 KB
#include "Memory2_lib.h"
#include<bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() );

void Solve(int T, int N){
  vector<int> a(N << 1, -1);

  vector<int> rem(N << 1); iota(all(rem), 0);
  while (sz(rem) > 1) {
    int chosen = rem[rng() % sz(rem)];
    for (const auto &i : rem) if (i ^ chosen) a[i] = Flip(chosen, i);
    a[chosen] = *max_element(all(a) );

    vector<int> nRem;
    for (const auto &i : rem) if (i ^ chosen && a[i] == a[chosen]) nRem.emplace_back(i);
    rem.swap(nRem);
  }

  for (int i = 0; i < N; ++i) {
    int x = (int)(find(all(a), i) - a.begin() ),
        y = (int)(find( (x + 1) + all(a), i) - a.begin() );
    Answer(x, y, i);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -