답안 #253506

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
253506 2020-07-28T06:14:39 Z SorahISA 가로등 (APIO19_street_lamps) C++17
20 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
#define double long double
using pii = pair<int, int>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back
#define fastIO() ios_base::sync_with_stdio(false), cin.tie(0)

int32_t main() {
    fastIO();
    
    int n, q, x, l, r;
    string s, op;
    cin >> n >> q >> s;
    
    vector<string> str(q + 1);
    str[0] = s;
    for (int i = 1; i <= q; ++i) {
        cin >> op, str[i] = str[i - 1];
        if (op == "toggle") {
            cin >> x, --x;
            str[i][x] ^= 1;
        }
        if (op == "query") {
            cin >> l >> r, --l, --r;
            int cnt = 0;
            for (int j = 0; j < i; ++j) {
                int fl = 1;
                for (int idx = l; idx < r; ++idx) fl &= (str[j][idx] ^ '0');
                cnt += fl;
            }
            cout << cnt << "\n";
        }
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5070 ms 17780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1408 KB Output is correct
2 Correct 39 ms 1408 KB Output is correct
3 Correct 76 ms 1400 KB Output is correct
4 Correct 140 ms 1392 KB Output is correct
5 Runtime error 1242 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 132 ms 1528 KB Output is correct
2 Correct 114 ms 1400 KB Output is correct
3 Correct 71 ms 1400 KB Output is correct
4 Correct 7 ms 1408 KB Output is correct
5 Runtime error 400 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Execution timed out 5070 ms 17780 KB Time limit exceeded
9 Halted 0 ms 0 KB -