Submission #433956

#TimeUsernameProblemLanguageResultExecution timeMemory
433956LouayFarahXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "xylophone.h" using namespace std; #define pb push_back void solve(int n) { /*orig.resize(n+1); for(int i = 1; i<=n; i++) cin >> orig[i];*/ vector<vector<ll>> q(n+1, vector<ll>(n+1, 0)); for(int i = 1; i<n; i++) { q[i][i+1] = query(i, i+1); } for(int i = 1; i<n-1;i++) { q[i][i+2] = query(i, i+2); } vector<int> arr(n+1); arr[1] = 1; for(int i = 1; i<n-1; i++) { if(q[i][i+2]==q[i][i+1]+q[i+1][i+2]) { arr[i+1] = arr[i]; } else { arr[i+1]-=arr[i]; } } for(int i = 1; i<n; i++) { arr[i]*=q[i][i+1]; } vector<int> res(n+1); res[1] = 1; for(int i = 1; i<n; i++) { res[i+1] = res[i] + arr[i]; } int mini = 1e9; for(int i = 1; i<=n; i++) mini = min(mini, res[i]); for(int i = 1; i<=n; i++) { res[i]-=mini; res[i]--; } bool flag = true; int l = n, r = 1; for(int i = 1; i<=n; i++) { if(res[i]<=0) { flag = false; break; } if(res[i]==1) l = i; if(res[i]==n) r = i; } if(l>=r) flag = false; if(flag) { for(int i = 1; i<=n; i++) answer(i, res[i]); } else { //res.assign(n+1, 1); for(int i = 1; i<n; i++) res[i+1] = res[i] - arr[i]; int mini = 1e9; for(int i = 1; i<=n; i++) mini = min(mini, res[i]); for(int i = 1; i<=n; i++) { res[i]-=mini; res[i]--; } for(int i = 1; i<=n; i++) mini = min(mini, res[i]); int dif = 1 - mini; for(int i = 1; i<=n; i++) res[i]+=dif; for(int i = 1; i<=n; i++) answer(i, res[i]); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:12:19: error: 'll' was not declared in this scope
   12 |     vector<vector<ll>> q(n+1, vector<ll>(n+1, 0));
      |                   ^~
xylophone.cpp:12:19: error: template argument 1 is invalid
xylophone.cpp:12:19: error: template argument 2 is invalid
xylophone.cpp:12:21: error: template argument 1 is invalid
   12 |     vector<vector<ll>> q(n+1, vector<ll>(n+1, 0));
      |                     ^~
xylophone.cpp:12:21: error: template argument 2 is invalid
xylophone.cpp:12:40: error: template argument 2 is invalid
   12 |     vector<vector<ll>> q(n+1, vector<ll>(n+1, 0));
      |                                        ^
xylophone.cpp:12:49: error: expression list treated as compound expression in initializer [-fpermissive]
   12 |     vector<vector<ll>> q(n+1, vector<ll>(n+1, 0));
      |                                                 ^
xylophone.cpp:15:10: error: invalid types 'int[int]' for array subscript
   15 |         q[i][i+1] = query(i, i+1);
      |          ^
xylophone.cpp:19:10: error: invalid types 'int[int]' for array subscript
   19 |         q[i][i+2] = query(i, i+2);
      |          ^
xylophone.cpp:27:13: error: invalid types 'int[int]' for array subscript
   27 |         if(q[i][i+2]==q[i][i+1]+q[i+1][i+2])
      |             ^
xylophone.cpp:27:24: error: invalid types 'int[int]' for array subscript
   27 |         if(q[i][i+2]==q[i][i+1]+q[i+1][i+2])
      |                        ^
xylophone.cpp:27:34: error: invalid types 'int[int]' for array subscript
   27 |         if(q[i][i+2]==q[i][i+1]+q[i+1][i+2])
      |                                  ^
xylophone.cpp:39:18: error: invalid types 'int[int]' for array subscript
   39 |         arr[i]*=q[i][i+1];
      |                  ^