QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#35394#866. Display of SpringswdnmdAC ✓152ms3768kbC++201.6kb2022-06-15 20:55:492022-06-15 20:55:51

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-15 20:55:51]
  • 评测
  • 测评结果:AC
  • 用时:152ms
  • 内存:3768kb
  • [2022-06-15 20:55:49]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
	ll x=0,f=1;char c=getchar();
	while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if (c=='-') f=-1,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}

const int N = 510;
int n,m=1e5;

int tot,rt,ls[N],rs[N],t[N];
inline int cmp(int x,int y,int z){
	cout<<"? "<<x-1<<" "<<y-1<<" "<<z<<endl;
	static char ret[10];
	scanf("%s",ret);
	return ret[0]=='F';
}
inline void insert(int &u,int l,int r,int x){
	if (!u){
		u=++tot,t[u]=x;
		return;
	}
	int mid=l+r>>1;
	if (cmp(x,t[u],mid)) swap(t[u],x);
	if (cmp(x,t[u],l)) insert(ls[u],l,mid,x);
	else if (cmp(x,t[u],r)) insert(rs[u],mid+1,r,x);  
}
int ans;
inline void Query(int u,int l,int r,int ql){
	if (!u) return;
	if (!ans||cmp(t[u],ans,ql)) ans=t[u];
	int mid=l+r>>1;
	if (ql<=mid) Query(ls[u],l,mid,ql);
		else Query(rs[u],mid+1,r,ql);
}

int main(){
	n=read();
	For(i,1,n) insert(rt,1,m,i);
	cout<<"!"<<endl;
	while (233){
		char op[10];
		scanf("%s",op);
		if (op[0]=='F') break;
		int x;
		scanf("%d",&x);
		ans=0,Query(rt,1,m,x);
		cout<<"! "<<ans-1<<endl;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3700kb

input:

3
FIRST
SECOND
SECOND
FIRST
FIRST
QUESTION 2
FIRST
QUESTION 6
SECOND
FINISH

output:

? 1 0 50000
? 0 1 1
? 0 1 100000
? 2 1 50000
? 1 2 1
!
? 1 2 2
! 1
? 1 2 6
! 2

result:

ok Correct answer

Test #2:

score: 0
Accepted
time: 4ms
memory: 3696kb

input:

6
FIRST
EQUAL
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
QUESTION 1
FIRST
FIRST
FIRST
FIRST
QUESTION 2
FIRST
FIRST
FIRST
EQUAL
QUESTION 3
FIRST
FIRST
EQUAL
SECOND
QUESTION 4
FIRST
EQUAL
SECOND
SECOND
QUESTION 5
FIRST...

output:

? 1 0 50000
? 0 1 1
? 0 1 100000
? 2 1 50000
? 1 2 1
? 3 2 50000
? 2 3 1
? 2 1 25000
? 1 2 1
? 4 3 50000
? 3 4 1
? 3 2 25000
? 2 3 1
? 2 1 12500
? 1 2 1
? 5 4 50000
? 4 5 1
? 4 3 25000
? 3 4 1
? 3 2 12500
? 2 3 1
? 2 1 6250
? 1 2 1
!
? 4 5 1
? 3 4 1
? 2 3 1
? 1 2 1
! 1
? 4 5 2
? 3 4 2
? 2 3 2
? 1 2 ...

result:

ok Correct answer

Test #3:

score: 0
Accepted
time: 9ms
memory: 3768kb

input:

326
SECOND
SECOND
SECOND
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND...

output:

? 1 0 50000
? 1 0 1
? 1 0 100000
? 2 0 50000
? 2 0 1
? 3 0 50000
? 0 3 1
? 0 2 25000
? 2 0 1
? 4 3 50000
? 4 3 1
? 4 0 25000
? 4 0 1
? 4 2 12500
? 2 4 1
? 2 4 25000
? 5 3 50000
? 5 3 1
? 5 3 100000
? 6 3 50000
? 6 3 1
? 6 0 25000
? 6 0 1
? 6 0 50000
? 7 3 50000
? 7 3 1
? 7 0 25000
? 7 0 1
? 7 0 5000...

result:

ok Correct answer

Test #4:

score: 0
Accepted
time: 7ms
memory: 3768kb

input:

19
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
FIRST
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SE...

output:

? 1 0 50000
? 0 1 1
? 0 1 100000
? 2 1 50000
? 2 1 1
? 2 1 100000
? 3 1 50000
? 3 1 1
? 3 1 100000
? 4 1 50000
? 4 1 1
? 4 1 100000
? 5 1 50000
? 5 1 1
? 5 1 100000
? 6 1 50000
? 1 6 1
? 7 6 50000
? 7 6 1
? 7 6 100000
? 8 6 50000
? 6 8 1
? 6 8 100000
? 9 8 50000
? 8 9 1
? 8 9 100000
? 10 9 50000
? 1...

result:

ok Correct answer

Test #5:

score: 0
Accepted
time: 23ms
memory: 3692kb

input:

500
FIRST
SECOND
SECOND
FIRST
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND...

output:

? 1 0 50000
? 0 1 1
? 0 1 100000
? 2 1 50000
? 1 2 1
? 1 2 100000
? 3 2 50000
? 2 3 1
? 2 3 100000
? 4 3 50000
? 4 3 1
? 4 3 100000
? 5 3 50000
? 5 3 1
? 5 3 100000
? 6 3 50000
? 6 3 1
? 6 3 100000
? 7 3 50000
? 3 7 1
? 3 7 100000
? 8 7 50000
? 8 7 1
? 8 7 100000
? 9 7 50000
? 9 7 1
? 9 7 100000
? 1...

result:

ok Correct answer

Test #6:

score: 0
Accepted
time: 18ms
memory: 3612kb

input:

500
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQUAL
EQ...

output:

? 1 0 50000
? 1 0 1
? 1 0 100000
? 2 0 50000
? 2 0 1
? 2 0 100000
? 3 0 50000
? 3 0 1
? 3 0 100000
? 4 0 50000
? 4 0 1
? 4 0 100000
? 5 0 50000
? 5 0 1
? 5 0 100000
? 6 0 50000
? 6 0 1
? 6 0 100000
? 7 0 50000
? 7 0 1
? 7 0 100000
? 8 0 50000
? 8 0 1
? 8 0 100000
? 9 0 50000
? 9 0 1
? 9 0 100000
? 1...

result:

ok Correct answer

Test #7:

score: 0
Accepted
time: 16ms
memory: 3696kb

input:

500
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
FIRST
SECOND
SECOND
SECOND
SECOND
SECOND
SECON...

output:

? 1 0 50000
? 0 1 1
? 0 1 100000
? 2 1 50000
? 2 1 1
? 2 1 100000
? 3 1 50000
? 1 3 1
? 1 3 100000
? 4 3 50000
? 4 3 1
? 4 3 100000
? 5 3 50000
? 5 3 1
? 5 3 100000
? 6 3 50000
? 6 3 1
? 6 3 100000
? 7 3 50000
? 7 3 1
? 7 3 100000
? 8 3 50000
? 8 3 1
? 8 3 100000
? 9 3 50000
? 9 3 1
? 9 3 100000
? 1...

result:

ok Correct answer

Test #8:

score: 0
Accepted
time: 22ms
memory: 3640kb

input:

500
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SECOND
SE...

output:

? 1 0 50000
? 1 0 1
? 1 0 100000
? 2 0 50000
? 2 0 1
? 2 0 100000
? 3 0 50000
? 3 0 1
? 3 0 100000
? 4 0 50000
? 4 0 1
? 4 0 100000
? 5 0 50000
? 5 0 1
? 5 0 100000
? 6 0 50000
? 6 0 1
? 6 0 100000
? 7 0 50000
? 7 0 1
? 7 0 100000
? 8 0 50000
? 8 0 1
? 8 0 100000
? 9 0 50000
? 9 0 1
? 9 0 100000
? 1...

result:

ok Correct answer

Test #9:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2
FIRST
FIRST
QUESTION 64500
QUESTION 22602
SECOND
QUESTION 37446
SECOND
QUESTION 97972
QUESTION 78630
QUESTION 75591
QUESTION 63328
QUESTION 64746
QUESTION 94532
QUESTION 51275
QUESTION 12189
SECOND
QUESTION 64341
QUESTION 85825
QUESTION 63713
QUESTION 36778
SECOND
QUESTION 27116
SECOND
QUESTION 18...

output:

? 1 0 50000
? 0 1 1
!
! 1
? 0 1 22602
! 1
? 0 1 37446
! 1
! 1
! 1
! 1
! 1
! 1
! 1
! 1
? 0 1 12189
! 1
! 1
! 1
! 1
? 0 1 36778
! 1
? 0 1 27116
! 1
? 0 1 18630
! 1
! 1
? 0 1 28074
! 1
! 1
! 1
? 0 1 39195
! 1
! 1
? 0 1 1182
! 1
! 1
! 1
! 1
? 0 1 7017
! 1
? 0 1 13589
! 1
! 1
! 1
? 0 1 48324
! 1
! 1
! 1
...

result:

ok Correct answer

Test #10:

score: 0
Accepted
time: 7ms
memory: 3492kb

input:

2
FIRST
FIRST
QUESTION 54311
QUESTION 8466
FIRST
QUESTION 82055
QUESTION 65419
QUESTION 5271
FIRST
QUESTION 4799
FIRST
QUESTION 21521
SECOND
QUESTION 66767
QUESTION 24897
SECOND
QUESTION 69127
QUESTION 84527
QUESTION 23303
SECOND
QUESTION 88924
QUESTION 56421
QUESTION 88108
QUESTION 74033
QUESTION 2...

output:

? 1 0 50000
? 0 1 1
!
! 1
? 0 1 8466
! 0
! 1
! 1
? 0 1 5271
! 0
? 0 1 4799
! 0
? 0 1 21521
! 1
! 1
? 0 1 24897
! 1
! 1
! 1
? 0 1 23303
! 1
! 1
! 1
! 1
! 1
? 0 1 25348
! 1
? 0 1 10105
! 0
! 1
? 0 1 33359
! 1
? 0 1 49782
! 1
? 0 1 20392
! 1
! 1
! 1
? 0 1 4246
! 0
! 1
? 0 1 8620
! 0
? 0 1 30435
! 1
? 0...

result:

ok Correct answer

Test #11:

score: 0
Accepted
time: 152ms
memory: 3688kb

input:

500
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST...

output:

? 1 0 50000
? 1 0 1
? 2 0 50000
? 0 2 1
? 0 1 25000
? 1 0 1
? 3 2 50000
? 3 2 1
? 3 0 25000
? 0 3 1
? 0 1 12500
? 1 0 1
? 4 2 50000
? 2 4 1
? 2 3 25000
? 3 2 1
? 3 0 12500
? 0 3 1
? 0 1 6250
? 1 0 1
? 5 4 50000
? 5 4 1
? 5 2 25000
? 2 5 1
? 2 3 12500
? 3 2 1
? 3 0 6250
? 0 3 1
? 0 1 3125
? 1 0 1
? 6...

result:

ok Correct answer

Test #12:

score: 0
Accepted
time: 108ms
memory: 3696kb

input:

500
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
SECOND
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
SECOND
FIRST
FIRST
SECOND
FIR...

output:

? 1 0 50000
? 0 1 1
? 2 1 50000
? 1 2 1
? 1 0 25000
? 0 1 1
? 3 2 50000
? 3 2 1
? 3 1 25000
? 1 3 1
? 1 0 12500
? 0 1 1
? 4 2 50000
? 4 2 1
? 4 3 25000
? 4 3 1
? 4 1 12500
? 1 4 1
? 1 4 25000
? 5 2 50000
? 5 2 1
? 5 3 25000
? 5 3 1
? 5 4 12500
? 5 4 1
? 5 4 25000
? 5 1 18750
? 1 5 12501
? 1 5 25000
...

result:

ok Correct answer

Test #13:

score: 0
Accepted
time: 89ms
memory: 3616kb

input:

500
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
FIRS...

output:

? 1 0 50000
? 0 1 1
? 2 1 50000
? 1 2 1
? 1 0 25000
? 0 1 1
? 3 2 50000
? 3 2 1
? 3 1 25000
? 3 1 1
? 3 0 12500
? 0 3 1
? 4 2 50000
? 4 2 1
? 4 1 25000
? 4 1 1
? 4 3 12500
? 4 3 1
? 4 0 6250
? 0 4 1
? 5 2 50000
? 5 2 1
? 5 1 25000
? 5 1 1
? 5 3 12500
? 5 3 1
? 5 4 6250
? 5 4 1
? 5 0 3125
? 5 0 1
? 6...

result:

ok Correct answer

Test #14:

score: 0
Accepted
time: 117ms
memory: 3652kb

input:

500
FIRST
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
...

output:

? 1 0 50000
? 0 1 1
? 2 1 50000
? 2 1 1
? 2 0 25000
? 0 2 1
? 3 1 50000
? 3 1 1
? 3 1 100000
? 4 1 50000
? 4 1 1
? 4 2 25000
? 4 2 1
? 4 0 12500
? 0 4 1
? 5 1 50000
? 5 1 1
? 5 2 25000
? 5 2 1
? 5 4 12500
? 5 4 1
? 5 4 25000
? 6 1 50000
? 6 1 1
? 6 2 25000
? 6 2 1
? 6 4 12500
? 6 4 1
? 6 4 25000
? 6...

result:

ok Correct answer

Test #15:

score: 0
Accepted
time: 84ms
memory: 3712kb

input:

500
FIRST
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECON...

output:

? 1 0 50000
? 0 1 1
? 2 1 50000
? 1 2 1
? 1 0 25000
? 0 1 1
? 3 2 50000
? 3 2 1
? 3 1 25000
? 3 1 1
? 3 0 12500
? 0 3 1
? 4 2 50000
? 4 2 1
? 4 1 25000
? 4 1 1
? 4 3 12500
? 3 4 1
? 3 0 6250
? 0 3 1
? 5 2 50000
? 5 2 1
? 5 1 25000
? 5 1 1
? 5 4 12500
? 4 5 1
? 4 3 6250
? 3 4 1
? 3 0 3125
? 3 0 1
? 3...

result:

ok Correct answer

Test #16:

score: 0
Accepted
time: 48ms
memory: 3704kb

input:

500
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
FIRST
FIRST
FIRST
FIRST
SECOND
SECOND
FIRST
FIRST
FIRST
SECOND
FIRST
SECOND
FIRST
SECOND
FIRST
SEC...

output:

? 1 0 50000
? 0 1 1
? 2 1 50000
? 2 1 1
? 2 0 25000
? 2 0 1
? 3 1 50000
? 3 1 1
? 3 0 25000
? 3 0 1
? 3 2 12500
? 2 3 1
? 4 1 50000
? 4 1 1
? 4 0 25000
? 4 0 1
? 4 3 12500
? 4 3 1
? 4 2 6250
? 2 4 1
? 5 1 50000
? 5 1 1
? 5 0 25000
? 5 0 1
? 5 3 12500
? 5 3 1
? 5 4 6250
? 4 5 1
? 4 5 12500
? 6 1 5000...

result:

ok Correct answer