제출 #1119274

#제출 시각아이디문제언어결과실행 시간메모리
1119274KasymKBootfall (IZhO17_bootfall)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 355; int v[N], n, sm, cnt; bitset<N*N> dp, vis, tmp; struct node { int l, r; vector<int> val; } seg[N<<2]; void bld(int x, int l, int r){ seg[x].l = l, seg[x].r = r; if(l==r) return; int mid = (l+r)>>1; bld(x<<1, l, mid); bld(x<<1|1, mid+1, r); } void upd(int x, int l, int r, int u){ if(l>r) return; if(l>seg[x].r or r<seg[x].l) return; if(l <= seg[x].l and seg[x].r <= r){ seg[x].val.pb(u); return; } upd(x<<1, l, r, u); upd(x<<1|1, l, r, u); } void qry(int x, bitset<N*N> wow){ for(auto i : seg[x].val) wow=wow|(wow<<i); if(seg[x].l==seg[x].r){      cnt++;        sm -= v[seg[x].l]; vis.set(0); for(int i = 0; i <= sm; ++i) if(dp[i]){ int val = abs(sm-2*i); vis[val] = 1; }      if(cnt==1)        tmp=vis;      else        tmp &= vis; sm += v[seg[x].l]; return; } qry(x<<1, wow); qry(x<<1|1, wow); } int main(){ // freopen("file.txt", "r", stdin); scanf("%d", &n); bld(1, 1, n); dp[0] = 1; for(int i = 1; i <= n; ++i){ scanf("%d", v+i), sm += v[i]; upd(1, 1, i-1, v[i]); upd(1, i+1, n, v[i]); dp=dp|(dp<<v[i]); } if(sm&1 or !dp[sm/2]){ puts("0"); return 0; } dp.reset(); dp[0] = 1; qry(1, dp); vector<int> ans; for(int i = 0; i <= sm; ++i) if(tmp[i]) ans.pb(i); printf("%d\n", (int)ans.size()); for(auto i : ans) printf("%d ", i); puts(""); return 0; }

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

bootfall.cpp:50:2: error: extended character   is not valid in an identifier
   50 |       cnt++;
      |  ^
bootfall.cpp:50:5: error: extended character   is not valid in an identifier
   50 |       cnt++;
      |    ^
bootfall.cpp:50:8: error: extended character   is not valid in an identifier
   50 |       cnt++;
      |      ^
bootfall.cpp:51:2: error: extended character   is not valid in an identifier
   51 |         sm -= v[seg[x].l];
      |  ^
bootfall.cpp:51:5: error: extended character   is not valid in an identifier
   51 |         sm -= v[seg[x].l];
      |    ^
bootfall.cpp:51:8: error: extended character   is not valid in an identifier
   51 |         sm -= v[seg[x].l];
      |      ^
bootfall.cpp:51:11: error: extended character   is not valid in an identifier
   51 |         sm -= v[seg[x].l];
      |        ^
bootfall.cpp:58:2: error: extended character   is not valid in an identifier
   58 |       if(cnt==1)
      |  ^
bootfall.cpp:58:5: error: extended character   is not valid in an identifier
   58 |       if(cnt==1)
      |    ^
bootfall.cpp:58:8: error: extended character   is not valid in an identifier
   58 |       if(cnt==1)
      |      ^
bootfall.cpp:59:2: error: extended character   is not valid in an identifier
   59 |         tmp=vis;
      |  ^
bootfall.cpp:59:5: error: extended character   is not valid in an identifier
   59 |         tmp=vis;
      |    ^
bootfall.cpp:59:8: error: extended character   is not valid in an identifier
   59 |         tmp=vis;
      |      ^
bootfall.cpp:59:11: error: extended character   is not valid in an identifier
   59 |         tmp=vis;
      |        ^
bootfall.cpp:60:2: error: extended character   is not valid in an identifier
   60 |       else
      |  ^
bootfall.cpp:60:5: error: extended character   is not valid in an identifier
   60 |       else
      |    ^
bootfall.cpp:60:8: error: extended character   is not valid in an identifier
   60 |       else
      |      ^
bootfall.cpp:61:2: error: extended character   is not valid in an identifier
   61 |         tmp &= vis;
      |  ^
bootfall.cpp:61:5: error: extended character   is not valid in an identifier
   61 |         tmp &= vis;
      |    ^
bootfall.cpp:61:8: error: extended character   is not valid in an identifier
   61 |         tmp &= vis;
      |      ^
bootfall.cpp:61:11: error: extended character   is not valid in an identifier
   61 |         tmp &= vis;
      |        ^
bootfall.cpp: In function 'void qry(int, std::bitset<126025>)':
bootfall.cpp:50:2: error: '\U000000a0' was not declared in this scope
   50 |       cnt++;
      |  ^
bootfall.cpp:51:4: error: expected ';' before '\U000000a0'
   51 |         sm -= v[seg[x].l];
      |   ^~
      |   ;
bootfall.cpp:58:4: error: expected ';' before '\U000000a0'
   58 |       if(cnt==1)
      |   ^~
      |   ;
bootfall.cpp:60:4: error: expected ';' before '\U000000a0'
   60 |       else
      |   ^~
      |   ;
bootfall.cpp: In function 'int main()':
bootfall.cpp:71:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
bootfall.cpp:75:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |         scanf("%d", v+i), sm += v[i];
      |         ~~~~~^~~~~~~~~~~