제출 #965470

#제출 시각아이디문제언어결과실행 시간메모리
965470Trisanu_DasSterilizing Spray (JOI15_sterilizing)C++17
컴파일 에러
0 ms0 KiB
;#include <bits/stdc++.h> using namespace std; #define int long long int n, q, k, c[200005], BIT[100005]; set<int> s; void upd(int idx, int val){ for(; idx <= n; idx += (idx & -idx)) BIT[idx] += val; } int qry(int idx){ int ans = 0; for(; idx; idx -= (idx & -idx)) ans += BIT[idx]; return ans; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> q >> k; for(int i = 1; i <= n; i++){ cin >> c[i]; upd(i, c[i]); if(c[i]) s.insert(i); } while(q--){ int op; cin >> op; if(op == 1){ int idx, val; cin >> idx >> val; upd(idx, val - c[idx]); c[idx] = val; if(val) s.insert(idx); }else if(op == 2){ int l, r; cin >> l >> r; if(k == 1) continue; vector<int> del; for(auto it = s.begin(); it != s.end(); it++){ int x = *it; if(l <= x && x <= r) { upd(x, c[x] / k - c[x]); c[x] /= k; if(!c[x]) del.push_back(x); } } for(int x : del) s.erase(x); }else{ int l, r; cin >> l >> r; cout << qry(r) - qry(l - 1) << '\n'; } } }

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

sterilizing.cpp:1:2: error: stray '#' in program
    1 | ;#include <bits/stdc++.h>
      |  ^
sterilizing.cpp:1:3: error: 'include' does not name a type
    1 | ;#include <bits/stdc++.h>
      |   ^~~~~~~
sterilizing.cpp:6:1: error: 'set' does not name a type
    6 | set<int> s;
      | ^~~
sterilizing.cpp: In function 'int main()':
sterilizing.cpp:19:3: error: 'ios_base' has not been declared
   19 |   ios_base::sync_with_stdio(false); cin.tie(nullptr);
      |   ^~~~~~~~
sterilizing.cpp:19:37: error: 'cin' was not declared in this scope
   19 |   ios_base::sync_with_stdio(false); cin.tie(nullptr);
      |                                     ^~~
sterilizing.cpp:24:14: error: 's' was not declared in this scope
   24 |     if(c[i]) s.insert(i);
      |              ^
sterilizing.cpp:32:15: error: 's' was not declared in this scope
   32 |       if(val) s.insert(idx);
      |               ^
sterilizing.cpp:36:7: error: 'vector' was not declared in this scope
   36 |       vector<int> del;
      |       ^~~~~~
sterilizing.cpp:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
sterilizing.cpp:36:14: note: in expansion of macro 'int'
   36 |       vector<int> del;
      |              ^~~
sterilizing.cpp:37:21: error: 's' was not declared in this scope
   37 |       for(auto it = s.begin(); it != s.end(); it++){
      |                     ^
sterilizing.cpp:42:21: error: 'del' was not declared in this scope
   42 |           if(!c[x]) del.push_back(x);
      |                     ^~~
sterilizing.cpp:45:19: error: 'del' was not declared in this scope
   45 |       for(int x : del) s.erase(x);
      |                   ^~~
sterilizing.cpp:45:24: error: 's' was not declared in this scope
   45 |       for(int x : del) s.erase(x);
      |                        ^
sterilizing.cpp:48:7: error: 'cout' was not declared in this scope
   48 |       cout << qry(r) - qry(l - 1) << '\n';
      |       ^~~~