QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#669467#9484. Colored Complete Graphbulijiojiodibuliduo#WA 1ms3868kbC++171.3kb2024-10-23 18:42:132024-10-23 18:42:13

Judging History

This is the latest submission verdict.

  • [2024-10-23 18:42:13]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3868kb
  • [2024-10-23 18:42:13]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=601000;

VI p[2];
int n;
char s[10];
vector<PII> eg[2];
int query(int x,int y) {
	printf("%d %d\n",x,y);
	fflush(stdout);
	scanf("%s",s);
	int w=(s[0]=='R');
	eg[w].pb(mp(x,y));
	return w;
}
void answer(vector<PII> eg) {
	printf("!\n");
	for (auto [u,v]:eg) printf("%d %d\n",u,v);
	puts("");
}
int main() {
	scanf("%d",&n);
	rep(i,2,n+1) {
		p[query(1,i)].pb(i);
	}
	int p1=0,p2=0;
	while (p1<SZ(p[0])&&p2<SZ(p[1])) {
		int x=query(p[0][p1],p[1][p2]);
		if (x==0) p2++;
		else p1++;
	}
	if (SZ(eg[0])==n-1) {
		answer(eg[0]);
	} else {
		answer(eg[1]);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3868kb

input:

3

output:

1 2

result:

wrong answer invalid question