Submission #543189

#TimeUsernameProblemLanguageResultExecution timeMemory
543189LoboTropical Garden (IOI11_garden)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const long long inf = (long long) 1e18 + 10; const int inf1 = (int) 1e9 + 10; #define int long long #define dbl long double #define endl '\n' #define sc second #define fr first #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() const int maxn = -1; void solve() { cin >> n >> K >> H; for(int i = 1; i <= K; i++) { int x; cin >> x; mark[x] = i; } for(int i = 1; i <= n+1; i++) { dp1[i][i-1] = 1; } for(int sz = 1; sz <= n; sz++) { for(int l = 1; l <= n; l++) { int r = l+sz-1; if(r > n) return; pair<int,int> mn = mp(0,0); for(int i = l; i <= r; i++) { mn = min(mn, mp(mark[i],i)); } if(mn.fr != 0) { int i = mn.sc; int ans1 = 1; if(i-1 >= l) ans1 = dp1[l][i-1]; int ans2 = 1; if(i+1 <= r) ans2 = dp1[i+1][r]; dp1[l][r] = (ans1*ans2)%mod; } else { for(int i = l; i <= r; i++) { int ans1 = 1; if(i-1 >= l) ans1 = dp1[l][i-1]; int ans2 = 1; if(i+1 <= r) ans2 = dp1[i+1][r]; dp1[l][r]+= (ans1*ans2)%mod; dp1[l][r]%= mod; } } } } for(int h = 0; h <= H; h++) { for(int sz = 1; sz <= n; i++) { for(int l = 1; l <= n; l++) { if(l == r) { if(h == 0) dp[l][r][h] = 1; else dp[l][r][h] = 0; continue; } if(h == 0) { dp[l][r][h] = 0; } int r = l+sz-1; pair<int,int> mn = mp(0,0); for(int i = l; i <= r; i++) { mn = min(mn, mp(mark[i],i)); } if(mn.fr != 0) { int i = mn.sc; dp[l][r][h]+= dp[l][i-1][h-1] } } } } } int32_t main() { ios::sync_with_stdio(false); cin.tie(0); freopen("in.in", "r", stdin); // freopen("out.out", "w", stdout); int tt = 1; // cin >> tt; while(tt--) solve(); }

Compilation message (stderr)

garden.cpp: In function 'void solve()':
garden.cpp:18:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   18 |     cin >> n >> K >> H;
      |            ^
      |            yn
garden.cpp:18:17: error: 'K' was not declared in this scope
   18 |     cin >> n >> K >> H;
      |                 ^
garden.cpp:18:22: error: 'H' was not declared in this scope
   18 |     cin >> n >> K >> H;
      |                      ^
garden.cpp:22:9: error: 'mark' was not declared in this scope
   22 |         mark[x] = i;
      |         ^~~~
garden.cpp:26:9: error: 'dp1' was not declared in this scope
   26 |         dp1[i][i-1] = 1;
      |         ^~~
garden.cpp:37:33: error: 'mark' was not declared in this scope
   37 |                 mn = min(mn, mp(mark[i],i));
      |                                 ^~~~
garden.cpp:43:37: error: 'dp1' was not declared in this scope
   43 |                 if(i-1 >= l) ans1 = dp1[l][i-1];
      |                                     ^~~
garden.cpp:45:37: error: 'dp1' was not declared in this scope
   45 |                 if(i+1 <= r) ans2 = dp1[i+1][r];
      |                                     ^~~
garden.cpp:47:17: error: 'dp1' was not declared in this scope
   47 |                 dp1[l][r] = (ans1*ans2)%mod;
      |                 ^~~
garden.cpp:47:41: error: 'mod' was not declared in this scope; did you mean 'modf'?
   47 |                 dp1[l][r] = (ans1*ans2)%mod;
      |                                         ^~~
      |                                         modf
garden.cpp:52:41: error: 'dp1' was not declared in this scope
   52 |                     if(i-1 >= l) ans1 = dp1[l][i-1];
      |                                         ^~~
garden.cpp:54:41: error: 'dp1' was not declared in this scope
   54 |                     if(i+1 <= r) ans2 = dp1[i+1][r];
      |                                         ^~~
garden.cpp:56:21: error: 'dp1' was not declared in this scope
   56 |                     dp1[l][r]+= (ans1*ans2)%mod;
      |                     ^~~
garden.cpp:56:45: error: 'mod' was not declared in this scope; did you mean 'modf'?
   56 |                     dp1[l][r]+= (ans1*ans2)%mod;
      |                                             ^~~
      |                                             modf
garden.cpp:64:34: error: 'i' was not declared in this scope
   64 |         for(int sz = 1; sz <= n; i++) {
      |                                  ^
garden.cpp:66:25: error: 'r' was not declared in this scope
   66 |                 if(l == r) {
      |                         ^
garden.cpp:67:32: error: 'dp' was not declared in this scope; did you mean 'mp'?
   67 |                     if(h == 0) dp[l][r][h] = 1;
      |                                ^~
      |                                mp
garden.cpp:68:26: error: 'dp' was not declared in this scope; did you mean 'mp'?
   68 |                     else dp[l][r][h] = 0;
      |                          ^~
      |                          mp
garden.cpp:72:21: error: 'dp' was not declared in this scope; did you mean 'mp'?
   72 |                     dp[l][r][h] = 0;
      |                     ^~
      |                     mp
garden.cpp:72:27: error: 'r' was not declared in this scope
   72 |                     dp[l][r][h] = 0;
      |                           ^
garden.cpp:79:37: error: 'mark' was not declared in this scope
   79 |                     mn = min(mn, mp(mark[i],i));
      |                                     ^~~~
garden.cpp:84:21: error: 'dp' was not declared in this scope; did you mean 'mp'?
   84 |                     dp[l][r][h]+= dp[l][i-1][h-1]
      |                     ^~
      |                     mp
garden.cpp: In function 'int32_t main()':
garden.cpp:94:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   94 |     freopen("in.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~