제출 #775292

#제출 시각아이디문제언어결과실행 시간메모리
775292CESxRhinoAddk (eJOI21_addk)C++14
컴파일 에러
0 ms0 KiB
#include<iostream> #incude<deque> using namespace std; const int MAXN = 1e18; int mod = 1e9 + 7; int lazy[1000005]; int seg[1000005]; int a[1000005]; void push(int id,int left,int right) { int mid = (left + right) / 2; seg[id * 2] += lazy[id] * (mid - left + 1); seg[id * 2 + 1] += lazy[id] * (right - mid); lazy[id * 2] += lazy[id]; lazy[id * 2 + 1] += lazy[id]; lazy[id] = 0; } void update(int id,int l,int r,int u,int v,int val) { if (u > v) return; if (u == l and v == r) { seg[id] += val * (v - u + 1); lazy[id] += val; return; } push(id, l, r); int mid = (l + r) / 2; update(id * 2, l, mid, u, min(v, mid), val); update(id * 2 + 1, mid + 1, r, max(u, mid + 1), v, val); seg[id] = seg[id * 2] + seg[id * 2 + 1]; } int get(int id,int l,int r,int u,int v) { if(u > v) { return 0; } if(u == l and v == r) { return seg[id]; } push(id,l,r); int mid = (l + r)/2; return get(id * 2,l,mid,u,min(v,mid)) + get(id * 2 + 1,mid + 1,r,max(u,mid + 1),v); } void AcSolution() { int n,k,q; cin >> n >> k; int sum = 0; for(int i = 1;i <= n;i++) { cin >> a[i]; update(1,0,n,i,n,a[i]); } cin >> q; while(q--) { int type,l,r,x; cin >> type; if(type == 2) { cin >> l >> r >> x; int h = (l + x - 1); k = r - x; cout << get(1,0,n,h,r) - get(1,0,n,l - 1,k) << endl; } else { deque<int> v,d; for(int i = 0;i < k;i++) { int x; cin >> x; v.push_back(x); d.push_back(x); } d.push_back(d[0]); d.pop_front(); for(int i = 0;i < k;i++) { update(1,0,n,v[i],n,a[d[i]] - a[v[i]]); } int h = a[v[0]]; for(int i = 0;i < k - 1;i++) { a[v[i]] = a[d[i]]; } a[v[k - 1]] = h; } } } signed main() { // freopen("BDIGIT.inp", "r",stdin); // freopen("BDIGIT.out", "w",stdout); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while(t--) { AcSolution(); } }

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

Main.cpp:2:2: error: invalid preprocessing directive #incude; did you mean #include?
    2 | #incude<deque>
      |  ^~~~~~
      |  include
Main.cpp:4:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    4 | const int MAXN = 1e18;
      |                  ^~~~
Main.cpp: In function 'void AcSolution()':
Main.cpp:71:4: error: 'deque' was not declared in this scope
   71 |    deque<int> v,d;
      |    ^~~~~
Main.cpp:2:1: note: 'std::deque' is defined in header '<deque>'; did you forget to '#include <deque>'?
    1 | #include<iostream>
  +++ |+#include <deque>
    2 | #incude<deque>
Main.cpp:71:10: error: expected primary-expression before 'int'
   71 |    deque<int> v,d;
      |          ^~~
Main.cpp:76:5: error: 'v' was not declared in this scope
   76 |     v.push_back(x);
      |     ^
Main.cpp:77:5: error: 'd' was not declared in this scope
   77 |     d.push_back(x);
      |     ^
Main.cpp:79:4: error: 'd' was not declared in this scope
   79 |    d.push_back(d[0]);
      |    ^
Main.cpp:83:18: error: 'v' was not declared in this scope
   83 |     update(1,0,n,v[i],n,a[d[i]] - a[v[i]]);
      |                  ^
Main.cpp:85:14: error: 'v' was not declared in this scope
   85 |    int h = a[v[0]];
      |              ^
Main.cpp:51:6: warning: unused variable 'sum' [-Wunused-variable]
   51 |  int sum = 0;
      |      ^~~