# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
568838 | almothana05 | Street Lamps (APIO19_street_lamps) | C++14 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 10000000000000000
using namespace std;
vector<int>num[200];
int main(){
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
string s;
int menge , numm , nummer , ed , cmp , que ;;
cin >> menge >> que;
cin >> s;
num[0].push_back(0);
for(int i = 0 ; i < menge ; i++){
num[0].push_back(num[0][i] + s[i] - '0');
}
if(menge <= 100 && que <= 100){
for(int k = 0 ; k < que ; k++){
string t;
cin >> t >> numm;
if(t == "query"){
cin >> nummer;
numm--;
nummer--;
int erg = 0;
for(int i = k ; i >= 0 ; i--){
erg += (num[i][nummer] - num[i][numm]) / (nummer - numm);
// cout << erg << ' ';
}
cout << erg << "\n";
for(int i = 0 ; i <= menge ; i++){
num[k + 1].push_back(num[k][i]);
}
}
else{
// cout << s[numm - 1] << "\n";
if(s[numm - 1] == '0'){
s[numm - 1] = '1';
}
else{
s[numm - 1] = '0';
}
// cout << s[numm - 1]<< "\n";
num[k + 1].push_back(0);
for(int i = 0 ; i < menge ; i++){
num[k + 1].push_back(num[k + 1][i] + s[i] - '0');
// cout << num[k + 1][i]<< ' ';
}
// cout << "\n";
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |