답안 #172858

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172858 2020-01-02T16:59:05 Z arnold518 Memory 2 (JOI16_memory2) C++14
0 / 100
2 ms 376 KB
#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 100;

int T, N, ans[MAXN+10];
vector<int> t[MAXN+10];

void Solve(int _T, int _N)
{
    int i, j;
    T=_T; N=_N;
    srand(time(NULL));

    memset(ans, -1, sizeof(ans));
    int now;

    for(j=0; j<3; j++)
    {
        for(i=0; i<N; i++) t[i].clear();
        now=rand()%(2*N);
        while(ans[now]!=-1) now=rand()%(2*N);

        for(i=0; i<2*N; i++)
        {
            if(i==now) continue;
            int p=Flip(i, now);
            t[p].push_back(i);
        }

        for(i=0; i<N; i++)
        {
            if(t[i].size()%2==0) for(auto it : t[i]) ans[it]=i;
            else ans[now]=i;
        }

        int cnt=0, pos;
        for(i=0; i<N*2; i++) if(ans[i]==-1) cnt++, pos=i;
        if(cnt==1) { ans[pos]=N-1; break; }
        //for(i=0; i<N*2; i++) printf("%d ", ans[i]); printf(" -> %d\n", now);
    }

    //for(i=0; i<N*2; i++) printf("%d ", ans[i]);
    for(i=0; i<N; i++)
    {
        vector<int> V;
        for(j=0; j<2*N; j++) if(ans[j]==i) V.push_back(j);
        //printf("%d %d : %d\n", V[0], V[1], i);
        Answer(V[0], V[1], i);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -