제출 #475444

#제출 시각아이디문제언어결과실행 시간메모리
475444keta_tsimakuridzeAddk (eJOI21_addk)C++14
92 / 100
317 ms5792 KiB
#include<bits/stdc++.h> #define f first #define s second #define int long long #define pii pair<int,int> using namespace std; const int N = 2e5 + 5, mod = 1e9 + 7; // ! int t, n, q, a[N], tree[N]; void upd(int ind,int val) { for(ind;ind <= n; ind += ind & (-ind)) tree[ind] += val; } int get(int ind) { int ans = 0; for(ind; ind >= 1; ind -= (ind) & (-ind)) ans += tree[ind]; return ans; } main(){ int K; cin >> n >> K; if(K > 1) return 0; for(int i = 1; i <= n; i++) cin >> a[i], a[i] += a[i - 1], upd(i,a[i]); int q; cin >> q; while(q--) { int t; cin >> t; if(t == 1) { int x; cin >> x; continue; } int l,r,m; cin >> l >> r >> m; cout << get(r) - get(l + m - 2) - (get(r - m) - get(l - 2)) << endl; } }

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

Main.cpp: In function 'void upd(long long int, long long int)':
Main.cpp:10:6: warning: statement has no effect [-Wunused-value]
   10 |  for(ind;ind <= n; ind += ind & (-ind)) tree[ind] += val;
      |      ^~~
Main.cpp: In function 'long long int get(long long int)':
Main.cpp:14:6: warning: statement has no effect [-Wunused-value]
   14 |  for(ind; ind >= 1; ind -= (ind) & (-ind)) ans += tree[ind];
      |      ^~~
Main.cpp: At global scope:
Main.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...