QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#538060 | #5128. Dividing DNA | qwqqwqqwqe | WA | 0ms | 3804kb | C++17 | 1.2kb | 2024-08-30 22:20:33 | 2024-08-30 22:20:33 |
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 {
while (l<r && !present) {
l++;
present = query(l,r);
}
a[r] = l-1;
}
r++;
}
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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3804kb
input:
1
output:
? 0 0
result:
wrong answer l must be non-empty