# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1107049 | 2024-10-31T13:07:26 Z | InvMOD | 가로등 (APIO19_street_lamps) | C++14 | 1 ms | 504 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define gcd __gcd #define sz(v) (int) v.size() #define pb push_back #define pi pair<int,int> #define all(v) (v).begin(), (v).end() #define compact(v) (v).erase(unique(all(v)), (v).end()) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define dbg(x) "[" #x " = " << (x) << "]" ///#define int long long using ll = long long; using ld = long double; using ull = unsigned long long; template<typename T> bool ckmx(T& a, const T& b){if(a < b) return a = b, true; return false;} template<typename T> bool ckmn(T& a, const T& b){if(a > b) return a = b, true; return false;} const int N = 3e5+5; const ll MOD = 1e9+7; const ll INF = 1e18; int n, q; namespace Subtask1{ bool check(){return n <= 100 && q <= 100;} bool good(string& state, int l, int r){ for(int i = l; i <= r; i++) if(state[i] == '0') return false; return true; } void process() { string s; cin >> s; s = " " + s; vector<string> state(q+1); state[0] = s; for(int i = 1; i <= q; i++){ string op; cin >> op; if(op == "toggle"){ int idx; cin >> idx; // change type s[idx] = char((int(s[idx] - '0')^1) + '0'); state[i] = s; } else{ int l,r; cin >> l >> r; state[i] = s; int answer = 0; for(int j = 0; j < i; j++){ answer = answer + good(state[j], l, r); } cout << answer <<"\n"; } } } } void solve() { cin >> n >> q; if(Subtask1::check()) Subtask1::process(), exit(0); } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define name "InvMOD" if(fopen(name".INP", "r")){ freopen(name".INP","r",stdin); freopen(name".OUT","w",stdout); } int t = 1; //cin >> t; while(t--) solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |