# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
926222 |
2024-02-12T17:33:11 Z |
jpfr12 |
Lollipop (POI11_liz) |
C++17 |
|
2000 ms |
2952 KB |
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <fstream>
#include <bitset>
#include <iomanip>
typedef long long ll;
typedef unsigned long long int ull;
using namespace std;
int MOD = (int)1e9+7;
int MAXN = 1e6;
//classes
//global
int n, k;
string str;
string sol(int& cost){
int sum = 0;
int left = 0;
for(int right = 0; right < n; right++){
sum += (str[right] == 'T'? 2: 1);
while(sum > cost){
sum -= (str[left] == 'T' ? 2: 1);
left++;
}
if(sum == cost){
string ans = "";
ans += to_string(left+1) +" "+ to_string(right+1);
return ans;
}
}
return "NIE";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
//ifstream fin("hps.in");
//ofstream fout("hps.out");
//stop
cin >> n >> k >> str;
while(k--){
int cost;
cin >> cost;
cout << sol(cost) << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
22 ms |
628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
552 KB |
Output is correct |
2 |
Correct |
32 ms |
504 KB |
Output is correct |
3 |
Correct |
41 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
181 ms |
956 KB |
Output is correct |
2 |
Correct |
224 ms |
776 KB |
Output is correct |
3 |
Correct |
862 ms |
1848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1421 ms |
1872 KB |
Output is correct |
2 |
Execution timed out |
2066 ms |
2568 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2057 ms |
1616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2025 ms |
1748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2068 ms |
1628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2011 ms |
1872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2040 ms |
2628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2016 ms |
2952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |