| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360197 | MuhammadSaram | Street Lamps (APIO19_street_lamps) | C++20 | 44 ms | 5128 KiB |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
ios::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
int n,q;
cin>>n>>q;
string s;
cin>>s;
int ls[n]={}, su[n]={};
for (int i=1;i<=q;i++)
{
string t;
cin>>t;
if (t=="toggle")
{
int x;
cin>>x;
x--;
if (s[x]=='1')
su[x]+=i-ls[x];
ls[x]=i;
s[x]='1'-s[x]+'0';
}
else
{
int a,b;
cin>>a>>b;
a--;
cout<<su[a]+(s[a]=='1'?i-ls[a]:0)<<endl;
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
