제출 #1256850

#제출 시각아이디문제언어결과실행 시간메모리
1256850blankcodesSecret (JOI14_secret)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int N, bsz, arr[1000000], blk[1001]; inline int op(int x,int y){return x+y;} void Init(int n,int a[]){ N=n; bsz=(int)sqrt(N)+1; memcpy(arr,a,sizeof(int)*N); fill(blk,blk+bsz,0); for(int i=0;i<N;i++) blk[i/bsz]=op(blk[i/bsz],arr[i]); } int Query(int L,int R){ int res=0; while(L<=R && L%bsz){ res=op(res,arr[L++]); } while(L+bsz-1<=R){ res=op(res,blk[L/bsz]); L+=bsz; } while(L<=R) res=op(res,arr[L++]); return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; static int a[1000000]; for(int i=0;i<n;i++) cin>>a[i]; Init(n,a); int q; cin>>q; while(q--){ int L,R; cin>>L>>R; cout<<Query(L,R)<<"\n"; } }

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

/usr/bin/ld: /tmp/ccw83TdV.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccw42KB0.o:secret.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status