답안 #111998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111998 2019-05-17T04:19:57 Z lauzm0 Memory 2 (JOI16_memory2) C++14
0 / 100
2 ms 384 KB
#include "Memory2_lib.h"
#include <iostream>
#include<vector>
#include<cmath>
using namespace std;

void Solve(int T, int n){
	vector<int>pp(2 * n); vector<int>rp; vector<vector<int> >flip1(2*n);
	for (int i = 0; i < 2*n; i++) {
		vector<int>p(n + 1, 0); 
		for (int j = 0; j < 2*n; j++) {
			if (i != j) {
				
				p[Flip(i,j)]++;
				flip1[i].push_back(Flip(i,j));
			}
		}
		for (int j = 0; j < n; j++) {
			if (p[j] % 2 == 1) {
				pp[p[j]] = j;
			}

		}
		
	}
	
	for (int i = 2 * n - 1; i > 0; i = i - 2) {
		rp.push_back(pp[i]);
	}

	

	int m = n - 1;
	int jk = 1;
	vector<int>a(2 * n); int counter = 2; bool cg = true;

	while (cg) {

		for (int i = 0; i < 2 * n; i++) {
			int count = 0;
			for (int j = 0; j < flip1[i].size(); j++) {
				if (flip1[i][j] == rp[m]) {
					count++;
				}
			}
			if (count == jk) {
				a[i] = rp[m];
				counter--;
				if (counter == 0) {
					jk = jk + 2;
					m--;
					counter = 2;
					break;
				}
				if (m < 0) {
					break;
				}
			}


		}
		if (m < 0) {
			cg = false;
		}

	}


	for(int i = 0  ; i <n; i++){
		int qqq=-1 ; int qqp=-1;
		for(int j = 0 ; j< a.size() ; j++){
			if(a[j]==i&&qqq==-1){
				qqq=j;
			}
			else if(a[j]==i && qqq!=-1) {
				
				Answer(qqq,qqp,i);
				break;
			}
		}
	}

}



Compilation message

memory2.cpp: In function 'void Solve(int, int)':
memory2.cpp:41:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int j = 0; j < flip1[i].size(); j++) {
                    ~~^~~~~~~~~~~~~~~~~
memory2.cpp:71:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0 ; j< a.size() ; j++){
                   ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -