Submission #315125

# Submission time Handle Problem Language Result Execution time Memory
315125 2020-10-22T02:56:01 Z thtsshz_bgwrswh Mouse (info1cup19_mouse) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("Ofast")
#include "grader.h"
#include<stdio.h>
#include<algorithm>
#include<assert.h>
using namespace std;
int num[260];
vector<int> temp,temp2;
//int N=5;
/*vector<int> target={1,2,3,4,5};
int query(vector<int> vec){
	int i,cnt=0;
	for(i=0;i<N;i++){
		printf("*%d\n",i);
		printf("%d\n",vec[i]);
		printf("%d\n",target[i]);
		if(vec[i]==target[i])
			cnt++;
	}
	return cnt;
}*/
int Q(int n,int id,int j){	
	int i,a,b;
	for(i=1;i<=n;i++)
		if(i!=j){
			a=i;
			break;
		}
	for(i=1;i<=n;i++)
		if(i!=j&&i!=a){
			b=i;
			break;
		}
	for(i=0;i<n;i++){
		temp[i]=a;
		temp2[i]=b;
	}
	temp[id]=temp2[id]=j;
//	for(i=0;i<n;i++)
//		printf("**%d %d\n",temp[i],temp2[i]);
	return query(temp2);
}
void solve(int n){
	N=n;
	assert(n>=3);
	int i,j;
	temp.resize(n+1);
	temp2.resize(n+1);
	for(i=0;i<n;i++)
		for(j=1;j<=n;j++){
			if(Q(n,i,j)){
			//	printf("%d %d\n",i,j);
				num[i]=j;
				break;
			}
		}
	vector<int> ans(n+1);
//	for(i=0;i<n;i++)
//		ans[i]=num[i];
//	sort(num,num+n);
//	//for(i=0;i<n;i++)
//	//	assert(num[i]!=i);
	query(ans);
}
//int main(){
//	solve(5);
//}

Compilation message

mouse.cpp: In function 'void solve(int)':
mouse.cpp:44:2: error: 'N' was not declared in this scope
   44 |  N=n;
      |  ^