# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
709367 |
2023-03-13T13:41:54 Z |
600Mihnea |
Game (APIO22_game) |
C++17 |
|
1 ms |
208 KB |
#include <cstdio>
#include <cstdlib>
#include <vector>
#include "game.h"
#include "game.h"
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <sstream>
#include <chrono>
#include <cstring>
#include <numeric>
using namespace std;
int n;
int k;
vector<int> mn;
vector<int> mx;
vector<vector<int>> g;
vector<vector<int>> ig;
void init(int nn, int kk)
{
n = nn;
k = kk;
mn.clear();
mx.clear();
g.clear();
ig.clear();
mn.resize(n + 1);
mx.resize(n + 1);
g.resize(n + 1);
ig.resize(n + 1);
for (int i = 1; i <= n; i++)
{
mx[i] = -1;
mn[i] = k + 1;
}
for (int i = 1; i <= k; i++)
{
mn[i] = i;
}
}
bool F = 0;
void upd(int from, int to)
{
if (F)
{
return;
}
{
int val = (to <= k) ? (to) : (mn[to]);
if (val < mn[from])
{
mn[from] = val;
for (auto& vec : ig[from])
{
upd(vec, from);
}
}
}
{
int val = (from <= k) ? (from) : mx[from];
if (val > mx[to])
{
mx[to] = val;
for (auto& vec : g[to])
{
upd(vec, to);
}
}
}
if (mn[from] <= mx[from])
{
F = 1;
}
if (mn[to] <= mx[to])
{
F = 1;
}
}
int add_teleporter(int from, int to)
{
from++;
to++;
assert(1 <= from && from <= n);
assert(1 <= to && to <= n);
if (from == to)
{
if (from <= k)
{
return 1;
}
else
{
return 0;
}
}
if (to < from && from <= k)
{
return 1;
}
upd(from, to);
return F;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |