QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#736501#5128. Dividing DNA nicksms#WA 1ms3580kbC++17984b2024-11-12 11:26:252024-11-12 11:26:25

Judging History

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

  • [2024-11-12 11:26:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3580kb
  • [2024-11-12 11:26:25]
  • 提交

answer

/**
 *      Author:  Nicholas Winschel
 *      Created: 11.11.2024 22:16:13
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using db=long double;
template<class T> using V=vector<T>;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int,int>;
#define f first
#define s second
#define sz(x) (int)((x).size())
#define each(a,b) for (auto &a : b)

int main() {
  cin.tie(0)->sync_with_stdio(0); // initialize fast I/O

  int n; cin >> n;
  vi rb(n), dp(n);
  for (int i = 0; i < n; i++) {
    if (i) rb[i] = rb[i-1];
    if (rb[i] < i) rb[i]=i;
    while (1) {
      if (rb[i] == n) break;
      cout << "? " << i << " " << rb[i] << endl;
      string s; cin >> s;
      if (s == "absent") break;
      rb[i]++;
    }
  }
  for (int i = n-1; i >= 0; --i) {
    if (i < n-1) dp[i] = dp[i+1];
    if (rb[i] < n) {
      dp[i] = max(dp[i], 1+((rb[i]<n-1)?dp[rb[i]+1]:0));
    }
  }
  cout << dp[0] << "\n";

  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

? 0 0

result:

wrong answer l must be non-empty