QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#538071#5128. Dividing DNA qwqqwqqwqeWA 1ms3584kbC++171.3kb2024-08-30 22:45:422024-08-30 22:45:42

Judging History

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

  • [2024-08-30 22:45:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3584kb
  • [2024-08-30 22:45:42]
  • 提交

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;
}

詳細信息

Test #1:

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

input:

1

output:

? 0 0

result:

wrong answer l must be non-empty