Submission #172856

# Submission time Handle Problem Language Result Execution time Memory
172856 2020-01-02T16:54:40 Z arnold518 None (JOI16_memory2) C++14
0 / 100
2 ms 504 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(ans[i]!=-1) continue;
            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]);
    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);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -