제출 #838245

#제출 시각아이디문제언어결과실행 시간메모리
838245manizare가로등 (APIO19_street_lamps)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define F first #define S second #define all(a) a.begin(),a.end() #define pii pair<int,int> using namespace std ; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 1000 + 10 , inf = 1e9+10 ; int pre[maxn][maxn] ; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >>n >> q; string s; cin >> s; s= "0" + s; for(int i = 1; i <= q ; i++){ string a ; cin >> a; if(a[0] == 't'){ int x; cin >> x; if(s[x] == '0')s[x] = '1' ; else s[x] = '0' ; } for(int j = 1; j <= n; j++){ pre[i][j] = pre[i][j] + (s[j] == '0') ; } if(a[0] == 'q'){ int r , l; cin >> l >> r ; int ans = 0 ; for(int j = 1; j <= i ;j++){ if(pre[j][r] == pre[j][l-1])ans ++ ; } cout << ans << "\n" ; } } } /* */

컴파일 시 표준 에러 (stderr) 메시지

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:14:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |   cin >>n >> q;
      |         ^
      |         yn
street_lamps.cpp:14:14: error: 'q' was not declared in this scope
   14 |   cin >>n >> q;
      |              ^