QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#812228 | #186. Street Lamps | HossamHero7# | 0 | 34ms | 10264kb | C++20 | 1.0kb | 2024-12-13 13:10:01 | 2024-12-13 13:10:02 |
Judging History
answer
// In sha2 Allah IOI 2025
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
int n,q;
cin>>n>>q;
string s;
cin>>s;
vector<int> st(n);
vector<int> cnt(n);
vector<array<ll,3>> Q(q);
for(auto &[t,a,b] : Q){
string ty;
cin>>ty;
if(ty == "toggle") t = 0 , cin>>a , a --;
else t = 1 , cin>>a>>b , a -- , b -= 2;
}
for(int i=0;i<q;i++){
auto [t,a,b] = Q[i];
if(t){
if(s[a] == '1') {
cout<<cnt[a] + (i - st[a])<<endl;
}
else cout<<cnt[a]<<endl;
}
else {
s[a] = (s[a] == '1' ? '0' : '1');
if(s[a] == '0'){
cnt[a] += (i - st[a]);
}
else st[a] = i;
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3812kb
input:
5 7 11011 query 1 2 query 1 2 query 1 6 query 3 4 toggle 3 query 3 4 query 1 6
output:
0 1 2 0 1 6
result:
wrong answer 1st lines differ - expected: '1', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 34ms
memory: 10264kb
input:
100 300000 1100100000000101010010100111010001100010001100111101000010111110001101101110100100100110101010110010 query 13 14 query 42 43 toggle 64 query 78 79 toggle 85 query 35 36 toggle 35 query 4 5 toggle 5 query 4 5 query 42 43 query 35 36 query 13 14 query 14 15 toggle 15 toggle 31 query 20 21 q...
output:
0 0 0 5 0 0 0 6 0 13 0 17 0 0 20 0 25 0 0 35 37 15 40 43 0 46 20 49 51 0 54 52 56 0 35 31 69 72 7 4 0 0 51 82 84 89 43 0 94 96 0 70 0 102 26 8 45 20 108 121 20 108 107 0 0 28 0 134 138 112 35 141 52 145 0 150 0 152 0 0 73 0 163 0 100 0 33 172 134 150 177 179 75 133 188 46 0 196 22 0 199 0 141 205 20...
result:
wrong answer 4th lines differ - expected: '6', found: '5'
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
input:
1000 1003 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
152 67 54
result:
wrong answer 1st lines differ - expected: '0', found: '152'
Subtask #4:
score: 0
Wrong Answer
Test #30:
score: 0
Wrong Answer
time: 1ms
memory: 3644kb
input:
1000 1003 10111011001010101101100010101100100010100110001000000001001100111110101100110100010001111101101100110111110100011000111101100100000110110010101011101001101110111100010100100000110001010001111101001010100101011111010000001110111110001011010111101100000001001110101110011111000101101100011010...
output:
12 13 0 0 0 17 0 19 20 21 22 23 24 25 0 0 28 0 30 0 0 33 0 35 0 0 38 39 40 41 42 43 0 0 46 47 0 0 50 0 52 53 0 55 56 0 0 59 0 61 55 63 0 65 66 67 0 69 70 0 72 0 0 0 76 77 0 79 0 81 0 83 0 0 86 87 88 0 90 91 92 93 0 0 0 97 0 99 0 101 0 0 0 105 0 0 108 109 110 111 2 113 0 0 116 0 0 0 120 0 122 123 124...
result:
wrong answer 1st lines differ - expected: '0', found: '12'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%