Submission #954005

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9540052024-03-27 05:23:46thiago_bastosAlternating Heights (CCO22_day1problem1)C++17
25 / 25
251 ms11960 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 10;
int n, k, q, a[N], last[N], deg[N];
vector<int> adj[N];
bool is_dag(int l, int r) {
queue<int> q;
int count = 0;
for(int i = 0; i < n; ++i) {
deg[i] = 0;
adj[i].clear();
}
for(int i = l + 1; i <= r; ++i) {
if((i - l) % 2) {
++deg[a[i - 1]];
adj[a[i]].push_back(a[i - 1]);
} else {
++deg[a[i]];
adj[a[i - 1]].push_back(a[i]);
}
}
for(int i = 0; i < n; ++i) {
if(!deg[i]) {
if(adj[i].size())
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...