제출 #1326866

#제출 시각아이디문제언어결과실행 시간메모리
1326866Faisal_SaqibJump (BOI06_jump)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; const int N=102; const ll base=1e18; struct bigint { vector<ll> tp; bigint(ll x) { while(x) { tp.push_back(x%base); x/=base; } } bigint() { } }; void print(bigint a) { if(a.tp.size()==0) a.tp.push_back(0); int sa=a.tp.size(); // cout<<"Hola "<<a.tp.size()<<endl; for(int i=sa-1;i>=0;i--) { cout<<a.tp[i]; } cout<<endl; } bigint add(bigint a,bigint b) { bigint c; int sa=a.tp.size(); int sb=b.tp.size(); ll cry=0; for(int i=0;i<=max(sb,sa);i++) { ll cc=cry; if(i<sa)cc+=a.tp[i]; if(i<sb)cc+=b.tp[i]; c.tp.push_back(cc%base); cry=cc/base; } while(c.tp.size()>0 and c.tp.back()==0)c.tp.pop_back(); if(c.tp.size()==0)c.tp.push_back(0); return c; } bigint dp[N][N]; int g[N][N]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { cin>>g[i][j]; } } dp[n][n]=1; for(int i=n;i>=1;i--) { for(int j=n;j>=1;j--) { if(g[i][j]==0)continue; if(j+g[i][j]<=n) dp[i][j]=add(dp[i][j],dp[i][j+g[i][j]]); if(i+g[i][j]<=n) dp[i][j]=add(dp[i][j],dp[i+g[i][j]][j]); } } print(dp[1][1]); }

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

jump.cpp:9:5: error: 'vector' does not name a type
    9 |     vector<ll> tp;
      |     ^~~~~~
jump.cpp: In constructor 'bigint::bigint(ll)':
jump.cpp:14:13: error: 'tp' was not declared in this scope; did you mean 'tm'?
   14 |             tp.push_back(x%base);
      |             ^~
      |             tm
jump.cpp: In function 'void print(bigint)':
jump.cpp:24:10: error: 'struct bigint' has no member named 'tp'
   24 |     if(a.tp.size()==0)
      |          ^~
jump.cpp:25:11: error: 'struct bigint' has no member named 'tp'
   25 |         a.tp.push_back(0);
      |           ^~
jump.cpp:26:14: error: 'struct bigint' has no member named 'tp'
   26 |     int sa=a.tp.size();
      |              ^~
jump.cpp:30:17: error: 'struct bigint' has no member named 'tp'
   30 |         cout<<a.tp[i];
      |                 ^~
jump.cpp: In function 'bigint add(bigint, bigint)':
jump.cpp:37:14: error: 'struct bigint' has no member named 'tp'
   37 |     int sa=a.tp.size();
      |              ^~
jump.cpp:38:14: error: 'struct bigint' has no member named 'tp'
   38 |     int sb=b.tp.size();
      |              ^~
jump.cpp:43:23: error: 'struct bigint' has no member named 'tp'
   43 |         if(i<sa)cc+=a.tp[i];
      |                       ^~
jump.cpp:44:23: error: 'struct bigint' has no member named 'tp'
   44 |         if(i<sb)cc+=b.tp[i];
      |                       ^~
jump.cpp:45:11: error: 'struct bigint' has no member named 'tp'
   45 |         c.tp.push_back(cc%base);
      |           ^~
jump.cpp:48:13: error: 'struct bigint' has no member named 'tp'
   48 |     while(c.tp.size()>0 and c.tp.back()==0)c.tp.pop_back();
      |             ^~
jump.cpp:48:31: error: 'struct bigint' has no member named 'tp'
   48 |     while(c.tp.size()>0 and c.tp.back()==0)c.tp.pop_back();
      |                               ^~
jump.cpp:48:46: error: 'struct bigint' has no member named 'tp'
   48 |     while(c.tp.size()>0 and c.tp.back()==0)c.tp.pop_back();
      |                                              ^~
jump.cpp:49:10: error: 'struct bigint' has no member named 'tp'
   49 |     if(c.tp.size()==0)c.tp.push_back(0);
      |          ^~
jump.cpp:49:25: error: 'struct bigint' has no member named 'tp'
   49 |     if(c.tp.size()==0)c.tp.push_back(0);
      |                         ^~