Submission #111968

# Submission time Handle Problem Language Result Execution time Memory
111968 2019-05-17T02:43:48 Z TexTang None (JOI16_memory2) C++14
10 / 100
3 ms 512 KB
#include "Memory2_lib.h"
#include <iostream>
#include <vector>
using namespace std;

void Solve(int T, int N){
	pair <int,int> a[N];
	int count[2*N][2*N];
	bool visited[2*N];
	for(int i = 0;i < 2*N;i++) visited[i] = false;
	for(int i = 0;i < 2*N;i++){
		for(int j = 0;j < 2*N;j++){
			if(i != j){
				count[i][j] = Flip(i,j);
			} else {
				count[i][j] = -1;
			}
		}
	}
		
	for(int p = N - 1;p >= 0;p--){
		for(int i = 0;i < 2*N;i++){
			for(int j = 0;j < 2*N;j++){
				if(i != j){
					//cout << i << j << p << endl;
					if(count[i][j] == p && !visited[i] && !visited[j]){
						a[p].first = i;
						a[p].second = j;
						visited[i] = true;
						visited[j] = true;
						i = 2*N;
						break;
					}
				}

			}
		}
	}

	for(int i = 0;i < N;i++){
		//cout << a[i].first << a[i].second << i << endl;
		Answer(a[i].first, a[i].second, i);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -