| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1200258 | adiyer | 가로등 (APIO19_street_lamps) | C++20 | 5091 ms | 4676 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
const int N = 1e3 + 11;
ll n, q;
ll a[N][N];
char chr;
void solve(){
cin >> n >> q;
for(ll i = 1; i <= n; i++) cin >> chr, a[i][0] = chr - '0';
for(ll t = 1; t <= q; t++){
string s;
cin >> s;
for(ll i = 1; i <= n; i++) a[i][t] = a[i][t - 1];
if(s == "toggle"){
ll p;
cin >> p;
a[p][t] ^= 1;
}
else{
ll l, r, ans = 0;
cin >> l >> r;
for(ll i = 0; i < t; i++){
bool ok = 1;
for(ll j = l; j < r; j++) ok &= a[j][i];
ans += ok;
}
cout << ans << '\n';
}
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
// cin >> tt;
while(tt--) solve();
}| # | 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... | ||||
