답안 #209656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209656 2020-03-15T03:16:44 Z EntityIT Memory 2 (JOI16_memory2) C++14
50 / 100
5 ms 380 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() ^ rng() ) % sz(rem)];
    for (const auto &i : rem) if (i ^ chosen) a[i] = Flip(chosen, i);
    a[chosen] = -1;
    for (int i = 0; i < N; ++i) if (count(all(a), i) & 1) {
      a[chosen] = i;
      break ;
    }

    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);
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 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 380 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 5 ms 376 KB Wrong Answer[2]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 376 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 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct