제출 #802531

#제출 시각아이디문제언어결과실행 시간메모리
802531I_Love_EliskaM_비스킷 담기 (IOI20_biscuits)C++14
컴파일 에러
0 ms0 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<n;++i) #define pb push_back #define all(x) x.begin(), x.end() using ll = long long; const int N=1e5+5; bitset<N> bs; ll p2(ll x, vector<ll> a) { while (a.size()<=60) a.pb(0); ll s=1; int k=0; while (k<60 && (a[k]==0 || s>=(1ll<<k))) { s+=(a[k]<<k); ++k; } ll old=s; ll s2=1; for (int t=k; t<60; ++t) { if (!a[t]) continue; if (s2 >= (1ll<<(t-k))) { s2+=(a[t]<<(t-k)); } else { s=s2*old; old=s; s2=1; k=t; --t; } } s=s2*old; old=s; s2=1; return s; } #define int ll ll f(ll x, vector<pi>&a, int i) { if (i>=a.size()-1) return 1+(a[i].f/x); if (a[i]>=x) { a[i+1].f+=(a[i].f-x)>>(a[i+1].s-a[i].s); ll q1=f(x,a,i+1); a[i+1].f-=(a[i].f-x)>>(a[i+1].s-a[i].s); a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s); ll q2=f(x,a,i+1); a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s); return q1+q2; } else { a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s); ll q=f(x,a,i+1); a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s); return q; } } ll count_tastiness(ll x, vector<ll> a) { if (x==1) { return p2(x,a); } vector<pi> v; forn(i,a.size()) if (a[i]) v.pb({a[i],i}); return f(x,v,0); } #undef int

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

biscuits.cpp:41:19: error: 'pi' was not declared in this scope; did you mean 'p2'?
   41 | ll f(ll x, vector<pi>&a, int i) {
      |                   ^~
      |                   p2
biscuits.cpp:41:21: error: template argument 1 is invalid
   41 | ll f(ll x, vector<pi>&a, int i) {
      |                     ^
biscuits.cpp:41:21: error: template argument 2 is invalid
biscuits.cpp: In function 'll f(ll, int&, ll)':
biscuits.cpp:42:14: error: request for member 'size' in 'a', which is of non-class type 'int'
   42 |     if (i>=a.size()-1) return 1+(a[i].f/x);
      |              ^~~~
biscuits.cpp:42:35: error: invalid types 'int[ll {aka long long int}]' for array subscript
   42 |     if (i>=a.size()-1) return 1+(a[i].f/x);
      |                                   ^
biscuits.cpp:43:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   43 |     if (a[i]>=x) {
      |          ^
biscuits.cpp:44:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   44 |         a[i+1].f+=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:44:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   44 |         a[i+1].f+=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:44:33: error: invalid types 'int[ll {aka long long int}]' for array subscript
   44 |         a[i+1].f+=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                                 ^
biscuits.cpp:44:42: error: invalid types 'int[ll {aka long long int}]' for array subscript
   44 |         a[i+1].f+=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                                          ^
biscuits.cpp:46:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   46 |         a[i+1].f-=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:46:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   46 |         a[i+1].f-=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:46:33: error: invalid types 'int[ll {aka long long int}]' for array subscript
   46 |         a[i+1].f-=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                                 ^
biscuits.cpp:46:42: error: invalid types 'int[ll {aka long long int}]' for array subscript
   46 |         a[i+1].f-=(a[i].f-x)>>(a[i+1].s-a[i].s);
      |                                          ^
biscuits.cpp:47:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   47 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:47:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   47 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:47:31: error: invalid types 'int[ll {aka long long int}]' for array subscript
   47 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                               ^
biscuits.cpp:47:40: error: invalid types 'int[ll {aka long long int}]' for array subscript
   47 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                                        ^
biscuits.cpp:49:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   49 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:49:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   49 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:49:31: error: invalid types 'int[ll {aka long long int}]' for array subscript
   49 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                               ^
biscuits.cpp:49:40: error: invalid types 'int[ll {aka long long int}]' for array subscript
   49 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                                        ^
biscuits.cpp:52:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   52 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:52:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   52 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:52:31: error: invalid types 'int[ll {aka long long int}]' for array subscript
   52 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                               ^
biscuits.cpp:52:40: error: invalid types 'int[ll {aka long long int}]' for array subscript
   52 |         a[i+1].f+=(a[i].f)>>(a[i+1].s-a[i].s);
      |                                        ^
biscuits.cpp:54:10: error: invalid types 'int[ll {aka long long int}]' for array subscript
   54 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |          ^
biscuits.cpp:54:21: error: invalid types 'int[ll {aka long long int}]' for array subscript
   54 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                     ^
biscuits.cpp:54:31: error: invalid types 'int[ll {aka long long int}]' for array subscript
   54 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                               ^
biscuits.cpp:54:40: error: invalid types 'int[ll {aka long long int}]' for array subscript
   54 |         a[i+1].f-=(a[i].f)>>(a[i+1].s-a[i].s);
      |                                        ^
biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:64:12: error: 'pi' was not declared in this scope; did you mean 'p2'?
   64 |     vector<pi> v;
      |            ^~
      |            p2
biscuits.cpp:64:14: error: template argument 1 is invalid
   64 |     vector<pi> v;
      |              ^
biscuits.cpp:64:14: error: template argument 2 is invalid
biscuits.cpp:4:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define forn(i,n) for(int i=0;i<n;++i)
......
   65 |     forn(i,a.size()) if (a[i]) v.pb({a[i],i});
      |          ~~~~~~~~~~             
biscuits.cpp:65:5: note: in expansion of macro 'forn'
   65 |     forn(i,a.size()) if (a[i]) v.pb({a[i],i});
      |     ^~~~
biscuits.cpp:5:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    5 | #define pb push_back
      |            ^~~~~~~~~
biscuits.cpp:65:34: note: in expansion of macro 'pb'
   65 |     forn(i,a.size()) if (a[i]) v.pb({a[i],i});
      |                                  ^~