답안 #210523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210523 2020-03-17T15:04:14 Z bensonlzl CEOI16_icc (CEOI16_icc) C++14
0 / 100
8 ms 504 KB
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;

int s0, s1, a[105], b[105];

int par[105], sz[105];
int cnt[8], setbit;

void res(){
	for (int i = 0; i < 105; ++i){
		a[i] = b[i] = 0;
	}
	s0 = s1 = 0;
}

int solve(vector<int> A, vector<int> B){
	if (B.size() == 1) return B[0]; 
	vector<int> b0, b1;
	for (int i = 0; i < B.size(); ++i){
		if (i%2 == 0) b0.push_back(B[i]);
		else b1.push_back(B[i]);
	}
	res();
	for (int i = 0; i < A.size(); ++i){
		a[i] = A[i];
	}
	for (int i = 0; i < b0.size(); ++i){
		b[i] = b0[i];
	}
	int q = query(A.size(),b0.size(),a,b);
	if (q) return solve(A,b0);
	else return solve(A,b1);
}

void run(int n) {
    for (int i = 1; i < n; ++i){
    	for (int j = 0; j < 7; ++j){
    		res();
    		for (int v = 1; v <= n; ++v){
    			if (v & (1 << j)){
    				b[s1] = v;
    				s1++;
    			}
    			else{
    				a[s0] = v;
    				s0++;
    			}
    		}
    		cnt[j] = query(s0,s1,a,b);
    	}
    	for (int k = 0; k < 7; ++k){
    		if (cnt[k] == 1){
    			setbit = k;
    		}
    	}
    	vector<int> v0, v1;
    	for (int v = 1; v <= n; ++v){
			if (v & (1 << setbit)){
				v1.push_back(v);
			}
			else{
				v0.push_back(v);
			}
		}
		int x = solve(v0,v1), y = x;
		for (int j = 0; j < 7; ++j){
			y ^= (cnt[j] * (1 << j));
		}
		setRoad(x,y);
    }
}

Compilation message

icc.cpp: In function 'int solve(std::vector<int>, std::vector<int>)':
icc.cpp:20:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < B.size(); ++i){
                  ~~^~~~~~~~~~
icc.cpp:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < A.size(); ++i){
                  ~~^~~~~~~~~~
icc.cpp:28:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < b0.size(); ++i){
                  ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 504 KB Wrong road!
2 Halted 0 ms 0 KB -