| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 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;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
