Submission #321152

# Submission time Handle Problem Language Result Execution time Memory
321152 2020-11-11T08:02:02 Z lohacho None (JOI16_memory2) C++14
60 / 100
1 ms 512 KB
#include "Memory2_lib.h"
#include <bits/stdc++.h>

using namespace std;

using LL = long long;

void Solve(int T, int N){
    N *= 2;
    int ans[104];
    int pos[3] = {0, 1, 2};
    for(int i = 3; i < N; ++i){
        int val[3] = {Flip(pos[0], i), Flip(pos[1], i), Flip(pos[2], i)};
        if(val[0] == val[1] && val[1] == val[2]){
            ans[i] = val[0];
            continue;
        }
        if(val[0] <= val[1] && val[0] <= val[2]){
            ans[pos[0]] = val[0];
            pos[0] = i;
        }
        else if(val[1] <= val[0] && val[1] <= val[2]){
            ans[pos[1]] = val[1];
            pos[1] = i;
        }
        else{
            ans[pos[2]] = val[2];
            pos[2] = i;
        }
    }
    if(N == 2){
        ans[0] = ans[1] = 0;
        return;
    }
    int val[3] = {Flip(pos[0], pos[1]), Flip(pos[1], pos[2]), Flip(pos[2], pos[0])};
    if(val[0] == val[1]){
        ans[pos[1]] = val[0];
        ans[pos[0]] = ans[pos[2]] = val[2];
    }
    else if(val[1] == val[2]){
        ans[pos[2]] = val[1];
        ans[pos[0]] = ans[pos[1]] = val[0];
    }
    else{
        ans[pos[0]] = val[0];
        ans[pos[1]] = ans[pos[2]] = val[1];
    }
    for(int i = 0; i < N; ++i){
        if(ans[i] == -1){
            continue;
        }
        for(int j = i + 1; j < N; ++j){
            if(ans[i] == ans[j]){
                Answer(i, j, ans[i]);
                ans[j] = -1;
                break;
            }
        }
    }
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 368 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -