답안 #1000110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000110 2024-06-16T16:45:13 Z Dzadzo Island Hopping (JOI24_island) C++17
6 / 100
9 ms 596 KB
#include <bits/stdc++.h>
#include "island.h"
#define ll long long
#define pb push_back
#define S second
#define F first
#define pii pair<int,int>
#define vi vector <int>
#define vvi vector <vi>
#define vvvi vector <vvi>
#define vp vector <pii>
#define vvp vector <vp>
#define vb vector <bool>
#define vvb vector <vb>;
#define INF LLONG_MAX
#define MOD 1000000007
#define MAXN 300
using namespace std;

/*int query(int v,int k){
	cout<<v<<" "<<k<<"ask\n";
	int res;
	cin>>res;
	return res;
}
void answer(int x,int y){
	cout<<x<<" "<<y<<"edgee\n";
}
*/

int par[MAXN+1];
vp active(MAXN+1);
int n;
void add(int x){
	int k=active[x].S;
	if (k==n)return;
	k++;
	if (k==n){active[x]={0,0};return;}
	int res=query(x,k);
	if (res!=par[x]){active[x]={res,k};return;}
	k++;
	if (k==n){active[x]={0,0};return;}
	res=query(x,k);
	if (res!=par[x]){active[x]={res,k};return;}	
}
void solve(int N,int l){
	n=N;
	vi V;
	for (int i=1;i<n;i++)V.pb(query(1,i));
	vi cur={1};
	active[1]={V[0],1};
	vi next;
	for (int x:V){
		int vertice=0;
		for (int y:next)if (active[y].F==x)vertice=y;
	///	cout<<x<<'\n';
		if (vertice){
	///	    cout<<"MAGIS QVEMOT\n";
			answer(vertice,x);
			par[x]=vertice;
			add(x);
			cur=next;
			next={x};
		}else{
			for (int y:cur)if (active[y].F==x)vertice=y;
///			 cout<<"IGIVE SIMAGLE\n";
			answer(vertice,x);
			par[x]=vertice;
			add(vertice);
			next.pb(x);
			add(x);
		}
	}
	
}
/*signed main(){	
	int n,l;
	cin>>n>>l;
	solve(n,l);
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 9 ms 440 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 596 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 9 ms 440 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Incorrect 1 ms 596 KB Wrong Answer [5]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 6 ms 344 KB Wrong Answer [3]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -