QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#538070 | #5128. Dividing DNA | qwqqwqqwqe | WA | 1ms | 3732kb | C++17 | 1.3kb | 2024-08-30 22:45:14 | 2024-08-30 22:45:15 |
Judging History
answer
#include"bits/stdc++.h"
#define _det(...) fprintf(stderr,__VA_ARGS__)
#define Print(a) cerr<<a<<"\n"
#define IOS ios::sync_with_stdio(0);cin.tie(0)
#define Cases int T;cin>>T;while(T--)
#define Debug(in) cerr<<#in<<" = "<<(in)<<"\n"
#define Watch(in) Detect;Debug(in);
#define Detect _det("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
using namespace std;
const int maxn = 1e4+5;
int a[maxn];
int dp[maxn];
int query (int l, int r) {
cout<<"? "<<l-1<<" "<<r-1<<endl;
string s;cin>>s;
if (s == "present") return true;
else return false;
}
signed main () {
int n; cin>>n;
int r = 1;
int l = 1;
while (r<=n) {
int present = query(l,r);
if (present) {
a[r] = l-1;
if (a[r] == 0) a[r] = -1;
}
else {
l++;
while (l<=r && !present) {
present = query(l,r);
l++;
}
a[r] = l-1;
}
r++;
}
for (int i=1;i<=n;i++) {
cerr<<a[i]<<" ";
}
cerr<<endl;
for (int i=1;i<=n;i++) {
if (a[i] == -1) continue;
for (int j=0;j<=a[i];j++) {
dp[i] = max(dp[i],dp[j]+1);
}
}
cout<<"! "<<dp[n]<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3732kb
input:
1
output:
? 0 0
result:
wrong answer l must be non-empty