QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736501 | #5128. Dividing DNA | nicksms# | WA | 1ms | 3580kb | C++17 | 984b | 2024-11-12 11:26:25 | 2024-11-12 11:26:25 |
Judging History
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