답안 #111970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111970 2019-05-17T03:01:13 Z lauzm0 Memory 2 (JOI16_memory2) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
	int  n; cin >> 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;
				}
				if (m < 0) {
					break;
				}
			}


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

	}
	
	for (int i = 0; i < a.size(); i++) {
		cout << a[i] << " ";
	}


}

Compilation message

memory2.cpp: In function 'int main()':
memory2.cpp:14:7: error: 'flip' was not declared in this scope
     p[flip(i,j)]++;
       ^~~~
memory2.cpp:14:7: note: suggested alternative: 'flip1'
     p[flip(i,j)]++;
       ^~~~
       flip1
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:67:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < a.size(); i++) {
                  ~~^~~~~~~~~~