Submission #756912

#TimeUsernameProblemLanguageResultExecution timeMemory
756912Dan4Life건물 4 (JOI20_building4)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = (int)2e3+10; int n, a[2][mxN]; bool dp[mxN][mxN][2]; int main(){ cin >> n; for(int i = 1; i<=2*n; i++) cin >> a[0][i]; for(int i = 1; i<=2*n; i++) cin >> a[1][i]; dp[1][0][0]=dp[1][1][1] = 1; for(int i = 2; i <= 2*n; i++){ for(int j = 0; j <= n; j++){ for(int k = 0; k < 2; k++){ for(int l = 0; l < 2; l++){ if(a[l][i-1]<=a[k][i]) dp[i][j][k]|=dp[i-1][j-!!k][l]; } } } } int tot = n,p=(int)1e9; string ans = ""; for(int i = 2*n; i; i--){ for(int k = 0; k < 2; k++){ if(dp[i][tot][k] and a[k][i]<=p){ tot-=!!k; ans+=(k?'B':'A'); p=a[k][i]; break; } } if(!sz(ans)){cout<<-1;return 0;} } reverse(begin(ans),end(ans)); cout << ans << "\n"; }

Compilation message (stderr)

building4.cpp: In function 'int main()':
building4.cpp:28:13: error: 'sz' was not declared in this scope
   28 |         if(!sz(ans)){cout<<-1;return 0;}
      |             ^~