답안 #315111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315111 2020-10-22T02:37:12 Z thtsshz_bgwrswh Mouse (info1cup19_mouse) C++17
0 / 100
1 ms 512 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 Q(int n,int id,int j){	
	int i,a,b;
	for(i=1;i<=n;i++)
		if(i!=j)
			a=i;
	for(i=1;i<=n;i++)
		if(i!=j&&i!=a)
			b=i;
	for(i=0;i<n;i++){
		temp[i]=a;
		temp2[i]=b;
	}
	temp[id]=temp2[id]=j;
	return query(temp)&&query(temp2);
}
void solve(int n){
	int i,j;
	temp.resize(n+1);
	temp2.reserve(n+1);
	for(i=0;i<n;i++)
		for(j=1;j<=n;j++){
			if(Q(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);
}

Compilation message

mouse.cpp: In function 'int Q(int, int, int)':
mouse.cpp:10:8: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   10 |  int i,a,b;
      |        ^
mouse.cpp:19:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |   temp2[i]=b;
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -