Submission #1176068

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11760682025-03-29 20:27:42VMaksimoski008Passport (JOI23_passport)C++17
48 / 100
1297 ms1114112 KiB
#include <bits/stdc++.h>
#define ar array
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
int n; cin >> n;
vector<int> L(n+1), R(n+1);
for(int i=1; i<=n; i++) cin >> L[i] >> R[i];
vector<ar<int, 3> > G[n+1][n+1];
int dp[n+1][n+1];
for(int i=1; i<=n; i++) G[L[i]][R[i]].push_back({ i, i, 1 });
for(int i=1; i<=n; i++) {
for(int j=i+1; j<=n; j++) {
G[i+1][j].push_back({ i, j, 0 });
G[i][j-1].push_back({ i, j, 0 });
}
}
for(int i=1; i<=n; i++) {
int mn = 1e9, mx = 0;
for(int j=i; j<=n; j++) {
mn = min(mn, L[j]);
mx = max(mx, R[j]);
G[mn][j].push_back({ i, j, 1 });
G[i][mx].push_back({ i, j, 1 });
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...