QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#35392 | #866. Display of Springs | wdnmd | RE | 18ms | 3704kb | C++20 | 1.8kb | 2022-06-15 20:52:41 | 2022-06-15 20:52:42 |
Judging History
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;
}
//#define wdnmd
const int N = 510;
int n,m=1e5;
int tot,rt,ls[N],rs[N],t[N],times,now;
inline int cmp(int x,int y,int z){
++times;
if (now==0) assert(times<=20000);
// else assert(times<=20);
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);
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;
now=1;
while (233){
char op[10];
scanf("%s",op);
if (op[0]=='F') break;
int x;
scanf("%d",&x);
times=0,ans=0,Query(rt,1,m,x);
//assert(1<=ans&&ans<=n);
cout<<"! "<<ans-1<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
3 FIRST SECOND SECOND FIRST FIRST SECOND 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 100000 ! ? 1 2 2 ! 1 ? 1 2 6 ! 2
result:
ok Correct answer
Test #2:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
6 FIRST EQUAL SECOND FIRST FIRST SECOND FIRST FIRST FIRST FIRST SECOND SECOND FIRST FIRST FIRST FIRST FIRST FIRST SECOND SECOND SECOND FIRST FIRST FIRST FIRST FIRST FIRST FIRST FIRST SECOND SECOND SECOND SECOND QUESTION 1 FIRST FIRST FIRST FIRST QUESTION 2 FIRST FIRST FIRST EQUAL QUESTION 3 FIRST FI...
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 1 25000 ? 1 2 1 ? 1 2 50000 ? 2 3 100000 ? 4 3 50000 ? 3 4 1 ? 3 2 25000 ? 2 3 1 ? 2 1 12500 ? 1 2 1 ? 1 2 25000 ? 2 3 50000 ? 3 4 100000 ? 5 4 50000 ? 4 5 1 ? 4 3 25000 ? 3 4 1 ? 3 2 12500 ? 2 3 1 ? 2 1 6250 ?...
result:
ok Correct answer
Test #3:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
326 SECOND SECOND SECOND SECOND FIRST SECOND FIRST FIRST FIRST FIRST SECOND SECOND SECOND FIRST SECOND FIRST FIRST SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND FIRST SECOND SECOND SECOND SECOND SECOND FIRST SECOND SECOND SECOND SECOND FIRST SECOND SECOND SECOND SECOND SECOND SECOND SECOND...
output:
? 1 0 50000 ? 1 0 1 ? 1 0 100000 ? 2 0 50000 ? 2 0 1 ? 2 0 100000 ? 3 0 50000 ? 0 3 1 ? 0 2 25000 ? 2 0 1 ? 2 0 50000 ? 0 3 100000 ? 4 3 50000 ? 4 3 1 ? 4 0 25000 ? 4 0 1 ? 4 2 12500 ? 2 4 1 ? 2 4 25000 ? 4 0 50000 ? 4 3 100000 ? 5 3 50000 ? 5 3 1 ? 5 3 100000 ? 6 3 50000 ? 6 3 1 ? 6 0 25000 ? 6 0 1...
result:
ok Correct answer
Test #4:
score: 0
Accepted
time: 14ms
memory: 3656kb
input:
19 FIRST SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND SECOND FIRST FIRST SECOND 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 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 ? 1 6 100000 ? 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 ? 1...
result:
ok Correct answer
Test #5:
score: 0
Accepted
time: 18ms
memory: 3496kb
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: 0ms
memory: 3616kb
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: 1ms
memory: 3548kb
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: 7ms
memory: 3612kb
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: 12ms
memory: 3704kb
input:
2 FIRST FIRST SECOND 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 QUES...
output:
? 1 0 50000 ? 0 1 1 ? 0 1 100000 ! ! 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...
result:
ok Correct answer
Test #10:
score: 0
Accepted
time: 15ms
memory: 3656kb
input:
2 FIRST FIRST SECOND 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 QUE...
output:
? 1 0 50000 ? 0 1 1 ? 0 1 100000 ! ! 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 ...
result:
ok Correct answer
Test #11:
score: -100
Dangerous Syscalls
input:
500 SECOND FIRST SECOND FIRST FIRST FIRST FIRST SECOND SECOND SECOND FIRST FIRST FIRST FIRST FIRST SECOND SECOND SECOND FIRST FIRST FIRST FIRST FIRST FIRST FIRST FIRST SECOND SECOND SECOND SECOND SECOND FIRST FIRST FIRST FIRST FIRST FIRST FIRST FIRST FIRST SECOND SECOND SECOND SECOND SECOND SECOND F...
output:
? 1 0 50000 ? 1 0 1 ? 1 0 100000 ? 2 0 50000 ? 0 2 1 ? 0 1 25000 ? 1 0 1 ? 1 0 50000 ? 0 2 100000 ? 3 2 50000 ? 3 2 1 ? 3 0 25000 ? 0 3 1 ? 0 1 12500 ? 1 0 1 ? 1 0 25000 ? 0 3 50000 ? 3 2 100000 ? 4 2 50000 ? 2 4 1 ? 2 3 25000 ? 3 2 1 ? 3 0 12500 ? 0 3 1 ? 0 1 6250 ? 1 0 1 ? 1 0 12500 ? 0 3 25000 ? ...