QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#484881 | #6509. Not Another Range Query Problem | BalintR | TL | 69ms | 3580kb | C++20 | 1.8kb | 2024-07-20 04:31:45 | 2024-07-20 04:31:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef complex<double> cpx;
template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) begin(v), end(v)
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound(ALL(v), x) - (v).begin())
#define ubv(v, x) (upper_bound(ALL(v), x) - (v).begin())
template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << (arr)[_i]; cerr << endl;}
template <typename T, typename U>
ostream& operator<<(ostream &os, pair<T, U> p){return os << "(" << p.fs << ", " << p.sn << ")";}
int main(){
cin.sync_with_stdio(0); cin.tie(0);
int n, q;
cin >> n >> q;
string str; cin >> str;
while(q--){
int l, r, k;
cin >> l >> r >> k;
l--;
vector<char> vec(&str[l], &str[r]);
while(k--){
vector<char> newVec;
char prv = -1;
for(char ch : vec){
if(ch == prv) newVec.pb(ch);
prv = ch;
}
vec = move(newVec);
}
cout << SZ(vec) << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
9 7 100110001 2 5 1 3 6 1 4 8 2 2 7 1 1 9 1 1 9 0 1 9 8
output:
2 1 1 3 4 9 0
result:
ok 7 numbers
Test #2:
score: 0
Accepted
time: 69ms
memory: 3580kb
input:
100 100000 0000011010101000111011110110000111110101101010111111101011011010111001111010111000001000011000001010 76 99 3 25 84 7 45 83 11 10 12 10 69 86 4 27 28 1 22 42 42 4 86 25 26 91 22 20 81 17 50 78 0 77 93 50 31 50 34 7 46 13 78 89 0 79 98 0 2 84 33 58 93 11 56 75 2 55 77 68 7 9 41 44 46 11 47 ...
output:
8 13 4 0 3 0 0 0 0 4 29 0 0 0 12 20 0 0 5 0 0 0 0 0 0 0 0 10 18 1 0 57 0 0 11 0 3 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19 0 0 0 12 5 0 0 2 0 0 0 0 10 12 0 0 0 5 0 8 0 1 16 0 19 29 40 21 12 26 0 21 6 0 10 18 0 3 0 2 5 0 0 5 0 0 0 51 0 0 0 18 11 0 20 5 9 10 0 16 22 0 20 0 26 0 0 0 0 0 0 11 46 59 2 9 43 1...
result:
ok 100000 numbers
Test #3:
score: -100
Time Limit Exceeded
input:
100000 100000 0000000000000100001000000010000000010100000100000000000000100000010000000000000000000001100010000000100000000000000000000000000000000000010000000000001000000100000010000000000000000000000100001010000000000000100000101000001000010000000110000000001001100001001000001000000000000000000000...