답안 #111965

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111965 2019-05-17T02:23:24 Z mechfrog88 Memory 2 (JOI16_memory2) C++14
0 / 100
2 ms 404 KB
#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct s{
	ll num;
	ll times;
	bool operator <(const s& rhs) const {
		return times < rhs.times;
	}
};

void Solve(int T, int N){
	vector <ll> num(N,0);
	for (int x=0;x<N;x++){
		for (int z=0;z<N;z++){
			num[Flip(z,z+1)]++;
		}	
	}
	vector <s> arr(N);
	for (int z=0;z<N;z++){
		arr[z].num = z;
		arr[z].times = num[z];
	}
	sort(arr.begin(),arr.end());
	vector <ll> visited(N,false);
	for (int z=0;z<arr.size();z++){
		for (int x=0;x<N;x++){
			ll next = x+1;
			while (visited[next]){
				next++;
			}
			if (Flip(x,next) == arr[z].num){
				Answer(x,next,arr[z].num);
				visited[x] = true;
				visited[next] = true;
			}
		}
	}
	return;
}

Compilation message

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