# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
257673 | 2020-08-04T14:22:04 Z | trttrttrt | 가로등 (APIO19_street_lamps) | C++17 | 183 ms | 3832 KB |
// Dmitry _kun_ Sayutin (2019) #include <bits/stdc++.h> using std::cin; using std::cout; using std::cerr; using std::vector; using std::map; using std::array; using std::set; using std::string; using std::pair; using std::make_pair; using std::tuple; using std::make_tuple; using std::get; using std::min; using std::abs; using std::max; using std::swap; using std::unique; using std::sort; using std::generate; using std::reverse; using std::min_element; using std::max_element; #ifdef LOCAL #define LASSERT(X) assert(X) #else #define LASSERT(X) {} #endif template <typename T> T input() { T res; cin >> res; return res; } template <typename IT> void input_seq(IT b, IT e) { std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>); } #define SZ(vec) int((vec).size()) #define ALL(data) data.begin(),data.end() #define RALL(data) data.rbegin(),data.rend() #define TYPEMAX(type) std::numeric_limits<type>::max() #define TYPEMIN(type) std::numeric_limits<type>::min() int main() { std::iostream::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); // code here int n = input<int>(); int q = input<int>(); vector<char> state(n); for (int i = 0; i != n; ++i) state[i] = int(input<char>() == '1'); vector<int> sum(n); for (int tm = 1; tm <= q; ++tm) { if (input<string>() == "toggle") { int i = input<int>() - 1; if (state[i] == 0) sum[i] -= tm; else sum[i] += tm; state[i] ^= 1; } else { int a = input<int>() - 1; int b = input<int>() - 1; int ans = sum[a]; if (state[a] == 1) ans += tm; cout << ans << "\n"; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 105 ms | 1272 KB | Output is correct |
2 | Correct | 110 ms | 1276 KB | Output is correct |
3 | Correct | 118 ms | 1272 KB | Output is correct |
4 | Correct | 128 ms | 2728 KB | Output is correct |
5 | Correct | 158 ms | 2936 KB | Output is correct |
6 | Correct | 90 ms | 2424 KB | Output is correct |
7 | Correct | 183 ms | 2392 KB | Output is correct |
8 | Correct | 126 ms | 3832 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |