제출 #1171432

#제출 시각아이디문제언어결과실행 시간메모리
1171432LmaoLmaoHacker (BOI15_hac)C++20
컴파일 에러
0 ms0 KiB
x#include<bits/stdc++.h> #define fi first #define se second #define endl '\n' using namespace std; using ll = long long; using ii = pair<int, int>; using aa = array<ll,5>; const int N = 1e6; const int INF = 1e9; int S[2000005],lz[2000005]; int pre[500005]; void push(int id) { S[id*2]=min(S[id*2],lz[id]); S[id*2+1]=min(S[id*2+1],lz[id]); lz[id*2]=min(lz[id*2],lz[id]); lz[id*2+1]=min(lz[id*2+1],lz[id]); lz[id]=1e9; } void update(int id,int l,int r,int u,int v,int val) { if(v < l || r < u) return; if(u<=l && r<=v) { //cout << l << ' ' << r << ' ' << id << endl; S[id]=min(S[id],val); lz[id]=min(lz[id],val); return; } push(id); int m=(l+r)/2; update(id*2,l,m,u,v,val); update(id*2+1,m+1,r,u,v,val); S[id]=min(S[id*2],S[id*2+1]); } int get(int id,int l,int r,int pos) { if(pos < l || r < pos) return 0; if(l==r) { return S[id]; } push(id); int m=(l+r)/2; int t=get(id*2,l,m,pos); int t1=get(id*2+1,m+1,r,pos); return max(t,t1); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("CHONSO.inp", "r", stdin); //freopen("CHONSO.out", "w", stdout); int n; cin >> n; for(int i=1;i<=n*4;i++) { S[i]=1e9; lz[i]=1e9; } for(int i=1;i<=n;i++) { cin >> pre[i]; pre[i]+=pre[i-1]; } int k=(n+1)/2; for(int i=1;i<=n;i++) { ll sum,sum1; if(i<k) { sum=pre[i]; sum+=pre[n]-pre[n-k+i]; update(1,1,n,1,i,sum); update(1,1,n,n-k+i+1,n,sum); //cout << n << ' '<< endl; } else { sum=pre[i]-pre[i-k]; update(1,1,n,i-k+1,i,sum); } //cout << get(1,1,n,2) << ' '; } int ans=0; for(int i=1;i<=n;i++) { //cout << get(1,1,n,i) << endl; ans=max(ans,get(1,1,n,i)); } cout << ans; return 0; }

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

hac.cpp:1:2: error: stray '#' in program
    1 | x#include<bits/stdc++.h>
      |  ^
hac.cpp:1:1: error: 'x' does not name a type
    1 | x#include<bits/stdc++.h>
      | ^
hac.cpp:8:12: error: 'pair' does not name a type
    8 | using ii = pair<int, int>;
      |            ^~~~
hac.cpp:9:12: error: 'array' does not name a type
    9 | using aa = array<ll,5>;
      |            ^~~~~
hac.cpp: In function 'void push(int)':
hac.cpp:18:13: error: 'min' was not declared in this scope
   18 |     S[id*2]=min(S[id*2],lz[id]);
      |             ^~~
hac.cpp: In function 'void update(int, int, int, int, int, int)':
hac.cpp:28:15: error: 'min' was not declared in this scope
   28 |         S[id]=min(S[id],val);
      |               ^~~
hac.cpp:36:11: error: 'min' was not declared in this scope
   36 |     S[id]=min(S[id*2],S[id*2+1]);
      |           ^~~
hac.cpp: In function 'int get(int, int, int, int)':
hac.cpp:47:12: error: 'max' was not declared in this scope
   47 |     return max(t,t1);
      |            ^~~
hac.cpp: In function 'int main()':
hac.cpp:52:5: error: 'ios_base' has not been declared
   52 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
hac.cpp:53:5: error: 'cin' was not declared in this scope
   53 |     cin.tie(NULL);
      |     ^~~
hac.cpp:53:13: error: 'NULL' was not declared in this scope
   53 |     cin.tie(NULL);
      |             ^~~~
hac.cpp:1:1: note: 'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | x#include<bits/stdc++.h>
hac.cpp:85:13: error: 'max' was not declared in this scope
   85 |         ans=max(ans,get(1,1,n,i));
      |             ^~~
hac.cpp:87:5: error: 'cout' was not declared in this scope
   87 |     cout << ans;
      |     ^~~~