Submission #900696

#TimeUsernameProblemLanguageResultExecution timeMemory
900696stefanneaguBuilding 4 (JOI20_building4)C++17
100 / 100
581 ms26184 KiB
// ce mai de cacat scoala : Un respectabil domn profesor de la scoala pe care o iubeste insane de mult metehau suge pula #include <bits/stdc++.h> #warning Un respectabil domn profesor de la scoala pe care o iubeste metehau suge pula using namespace std; const int nmax = 1e6 + 1; int mat[nmax][2], ma[nmax][2], mi[nmax][2]; int main() { int n; cin >> n; for(int i = 0; i < 2; i ++) { for(int j = 0; j < 2 * n; j ++) { cin >> mat[j][i]; } } mi[0][1] = 1, ma[0][1] = 1; for(int i = 1; i < 2 * n; i ++) { for(int j = 0; j < 2; j ++) { mi[i][j] = 1e9, ma[i][j] = -1e9; for(int k = 0; k < 2; k ++) { if(mi[i - 1][k] <= ma[i - 1][k] && mat[i][j] >= mat[i - 1][k]) { mi[i][j] = min(mi[i][j], mi[i - 1][k] + j); ma[i][j] = max(ma[i][j], ma[i - 1][k] + j); } //cout << mi[i][j] << " " << ma[i][j] << endl; } } } int j; if(mi[2 * n - 1][0] <= n && n <= ma[2 * n - 1][0]) { j = 0; } else if(mi[2 * n - 1][1] <= n && n <= ma[2 * n - 1][1]) { j = 1; } else { cout << "-1\n"; return 0; // as avea tupeu sa bag numele dar mihnea = stalker nasol + paracios cout << "Un respectabil domn profesor de la scoala pe care o iubeste metehau suge pula"; } string ans = ""; for(int i = 2 * n - 1; i >= 0;) { if(j) { ans += 'B'; } else { ans += 'A'; } n -= j; i --; if(mi[i][1] <= n && n <= ma[i][1] && mat[i][1] <= mat[i + 1][j]) { j = 1; } else { j = 0; } } reverse(ans.begin(), ans.end()); cout << ans; return 0; }

Compilation message (stderr)

building4.cpp:4:2: warning: #warning Un respectabil domn profesor de la scoala pe care o iubeste metehau suge pula [-Wcpp]
    4 | #warning Un respectabil domn profesor de la scoala pe care o iubeste metehau suge pula
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...