//
#ifndef __SIZEOF_INT128__
#define __SIZEOF_INT128__
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define rep(i, p, k) for(int i(p); i < (k); ++i)
#define per(i, p, k) for(int i(p); i > (k); --i)
#define sz(x) (int)(x).size()
#define sc static_cast
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef __int128_t lll;
//#define int ll
template <typename T = int> using par = std::pair <T, T>;
#define fi first
#define se second
#define test int _number_of_tests(in()); while(_number_of_tests--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb emplace_back
struct Timer {
string name{""};
time_point<high_resolution_clock> end, start{high_resolution_clock::now()};
duration<float, std::milli> dur;
Timer() = default;
Timer(string nm): name(nm) {}
~Timer() {
end = high_resolution_clock::now(); dur= end - start;
cout << "@" << name << "> " << dur.count() << " ms" << '\n';
}
};
template <typename T = int> inline T in()
{
static T x;
std::cin >> x;
return x;
}
std::string yn(bool b)
{
if(b) return "YES\n";
else return "NO\n";
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par);
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek)
{
for(const auto& i : wek)out << i << ' ';
return out;
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par)
{
out << '{'<<par.first<<", "<<par.second<<"}";
return out;
}
#define show(x) cerr << #x << " = " << x << '\n';
constexpr int maxn = 2e5 + 3;
vector <int> graf[maxn];
vector <int> gra[maxn][2];
int byl[maxn][2];
void dfs(int w, bool b){
if(byl[w][b])return;
byl[w][b] = 1;
for(auto i: gra[w][b])dfs(i, b);
}
vector <int> check_validity (int n, vector <int> x, vector <int> y, vector <int> a, vector <int> b, vector <int> l, vector <int> r)
{
int m(sz(x)), q(sz(a));
rep(i, 0, m){
graf[x[i]].pb(y[i]);
graf[y[i]].pb(x[i]);
}
vector <int> odp;
rep(i, 0, q){
rep(i, 0, n){
gra[i][0].clear();
gra[i][1].clear();
byl[i][0] = byl[i][1] = 0;
}
rep(w, l[i], n)for(auto j: graf[w])if(j >= l[i]){
gra[w][0].pb(j);
gra[j][0].pb(w);
}
rep(w, 0, r[i]+1)for(auto j: graf[w])if(j <= r[i]){
gra[w][1].pb(j);
gra[j][1].pb(w);
}
dfs(a[i], 0);
dfs(b[i], 1);
bool o(0);
rep(i, 0, n)o |= byl[i][0] && byl[i][1];
odp.pb(o);
}
return odp;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
15704 KB |
Output is correct |
2 |
Correct |
5 ms |
15940 KB |
Output is correct |
3 |
Correct |
5 ms |
15708 KB |
Output is correct |
4 |
Correct |
7 ms |
15704 KB |
Output is correct |
5 |
Correct |
6 ms |
15708 KB |
Output is correct |
6 |
Correct |
6 ms |
15708 KB |
Output is correct |
7 |
Correct |
6 ms |
15964 KB |
Output is correct |
8 |
Correct |
6 ms |
15960 KB |
Output is correct |
9 |
Correct |
5 ms |
15708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
15704 KB |
Output is correct |
2 |
Correct |
5 ms |
15940 KB |
Output is correct |
3 |
Correct |
5 ms |
15708 KB |
Output is correct |
4 |
Correct |
7 ms |
15704 KB |
Output is correct |
5 |
Correct |
6 ms |
15708 KB |
Output is correct |
6 |
Correct |
6 ms |
15708 KB |
Output is correct |
7 |
Correct |
6 ms |
15964 KB |
Output is correct |
8 |
Correct |
6 ms |
15960 KB |
Output is correct |
9 |
Correct |
5 ms |
15708 KB |
Output is correct |
10 |
Correct |
481 ms |
16532 KB |
Output is correct |
11 |
Correct |
376 ms |
16496 KB |
Output is correct |
12 |
Correct |
211 ms |
16476 KB |
Output is correct |
13 |
Correct |
454 ms |
16724 KB |
Output is correct |
14 |
Correct |
357 ms |
16476 KB |
Output is correct |
15 |
Correct |
711 ms |
16732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4042 ms |
44372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
15704 KB |
Output is correct |
2 |
Correct |
5 ms |
15940 KB |
Output is correct |
3 |
Correct |
5 ms |
15708 KB |
Output is correct |
4 |
Correct |
7 ms |
15704 KB |
Output is correct |
5 |
Correct |
6 ms |
15708 KB |
Output is correct |
6 |
Correct |
6 ms |
15708 KB |
Output is correct |
7 |
Correct |
6 ms |
15964 KB |
Output is correct |
8 |
Correct |
6 ms |
15960 KB |
Output is correct |
9 |
Correct |
5 ms |
15708 KB |
Output is correct |
10 |
Correct |
481 ms |
16532 KB |
Output is correct |
11 |
Correct |
376 ms |
16496 KB |
Output is correct |
12 |
Correct |
211 ms |
16476 KB |
Output is correct |
13 |
Correct |
454 ms |
16724 KB |
Output is correct |
14 |
Correct |
357 ms |
16476 KB |
Output is correct |
15 |
Correct |
711 ms |
16732 KB |
Output is correct |
16 |
Execution timed out |
4042 ms |
44372 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |