/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
#include "parks.h"
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
#define VV(vvvv,NNNN,xxxx); REP(i,0,NNNN) {vvvv.pb(xxxx);}
ll mod=1000000007LL;
template<class A=ll>
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
class Graph
{
public:
ll N;
vector<vector<ll> > adj;
vector<ll> visited; //for DFS/BFS
vector<vector<ll> > dfs_tree;
Graph() {ll N=0LL;}
Graph(vector<vector<ll> > ad)
{
adj=ad; N=adj.size(); REP(i,0,N) {visited.pb(false);}
VV(dfs_tree,N,{});
}
void Reset()
{
REP(i,0,N) {visited[i]=false;}
}
void DFS_Tree(ll s)
{
if(visited[s]) {return;}
visited[s]=true;
REP(i,0,adj[s].size())
{
if(!visited[adj[s][i]]) {dfs_tree[s].pb(adj[s][i]); dfs_tree[adj[s][i]].pb(s); DFS_Tree(adj[s][i]);}
}
return;
}
};
class DiGraph
{
public:
ll N;
vector<vector<ll> > adj;
vector<bool> visited;
vector<ll> current; //for CC
vector<ll> SCC; //Attributes a number to each node
vector<vector<ll> > adjK; //reverse graph, for Kosaraju
DiGraph(vector<vector<ll> > ad)
{
adj=ad; N=adj.size(); REP(i,0,N) {visited.pb(false); SCC.pb(-1LL);}
vector<ll> xx; REP(i,0,N) {adjK.pb(xx);}
REP(i,0,adj.size())
{
REP(j,0,adj[i].size()) {adjK[adj[i][j]].pb(i);}
}
}
void Reset()
{
REP(i,0,N) {visited[i]=false;}
current.clear();
}
void DFS(ll s)
{
if(visited[s]) {return;}
visited[s]=true;
REP(i,0,adj[s].size())
{
if(!visited[adj[s][i]]) {DFS(adj[s][i]);}
}
current.pb(s); //only needed for Kosaraju
return;
}
void DFSK(ll s)
{
if(visited[s]) {return;}
visited[s]=true;
REP(i,0,adjK[s].size())
{
if(!visited[adjK[s][i]]) {DFSK(adjK[s][i]);}
}
current.pb(s); //only needed for Kosaraju
return;
}
void Kosaraju()
{
if(SCC[0]!=-1) {return;}
Reset();
REP(i,0,N)
{
if(visited[i]) {continue;}
DFS(i);
}
vector<ll> List=current;
Reset();
ll c=0LL;
for(ll i=N-1LL;i>=0LL;i--)
{
ll node=List[i];
if(visited[node]) {continue;}
DFSK(node);
REP(j,0,current.size()) {SCC[current[j]]=c;}
c++;
current.clear();
}
}
DiGraph SCCGraph()
{
Kosaraju();
set<pl> ed;
REP(i,0,adj.size())
{
REP(j,0,adj[i].size())
{
ed.insert(mp(SCC[i],SCC[adj[i][j]]));
}
}
vector<vector<ll> > a; vector<ll> xx;
ll nscc=-INF; REP(i,0,N) {nscc=max(nscc,SCC[i]+1);}
REP(i,0,nscc) {a.pb(xx);}
set<pl>::iterator it=ed.begin();
pl cur;
while(it!=ed.end())
{
cur=*it;
if(cur.ff!=cur.ss) {a[cur.ff].pb(cur.ss);}
it++;
}
DiGraph ans(a);
return ans;
}
};
vector<bool> SAT2(ll N, vector<pl> a) //a[i] is j+1 if yes j, -j-1 if not j
{
ll M=a.size();
vector<vector<ll> > adj; vector<ll> xx; REP(i,0,2*N) {adj.pb(xx);}
pl c;
REP(i,0,M)
{
if(a[i].ff==-a[i].ss) {continue;}
c.ff = -a[i].ff; c.ss=a[i].ss;
if(c.ff<0) {c.ff=2*(-c.ff)-1;}
else {c.ff=2*c.ff-2;}
if(c.ss<0) {c.ss=2*(-c.ss)-1;}
else {c.ss=2*c.ss-2;}
adj[c.ff].pb(c.ss);
swap(a[i].ff,a[i].ss);
c.ff = -a[i].ff; c.ss=a[i].ss;
if(c.ff<0) {c.ff=2*(-c.ff)-1;}
else {c.ff=2*c.ff-2;}
if(c.ss<0) {c.ss=2*(-c.ss)-1;}
else {c.ss=2*c.ss-2;}
adj[c.ff].pb(c.ss);
}
DiGraph G(adj); G.Kosaraju();
vector<bool> ans; REP(i,0,N) {if(G.SCC[2*i]==G.SCC[2*i+1]) {return ans;}}
REP(i,0,N)
{
if(G.SCC[2*i]>G.SCC[2*i+1]) {ans.pb(true);}
else {ans.pb(false);}
}
return ans;
}
ll construct_roads(vector<ll> x, vector<ll> y)
{
ll N = x.size(); vector<vector<ll> > adj; VV(adj,N,{});
if(N==1) {build({},{},{},{}); return 1;}
vector<pair<pl,ll> > p; REP(i,0,N) {p.pb({{x[i],y[i]},i});} sort(whole(p));
vector<pair<pl,ll> >::iterator it; ll nei;
REP(i,0,N)
{
it=lower_bound(whole(p),(pair<pl,ll>){{x[i]-2,y[i]},0});
if(it!=p.end())
{
nei=it->ss;
if(it->ff==(pl){x[i]-2,y[i]}) {adj[i].pb(nei); adj[nei].pb(i);}
}
it=lower_bound(whole(p),(pair<pl,ll>){{x[i]+2,y[i]},0});
if(it!=p.end())
{
nei=it->ss;
if(it->ff==(pl){x[i]+2,y[i]}) {adj[i].pb(nei); adj[nei].pb(i);}
}
it=lower_bound(whole(p),(pair<pl,ll>){{x[i],y[i]-2},0});
if(it!=p.end())
{
nei=it->ss;
if(it->ff==(pl){x[i],y[i]-2}) {adj[i].pb(nei); adj[nei].pb(i);}
}
it=lower_bound(whole(p),(pair<pl,ll>){{x[i],y[i]+2},0});
if(it!=p.end())
{
nei=it->ss;
if(it->ff==(pl){x[i],y[i]+2}) {adj[i].pb(nei); adj[nei].pb(i);}
}
}
Graph G(adj); G.Reset(); G.DFS_Tree(0);
vector<vector<ll> > tree = G.dfs_tree;
REP(i,0,N) {if(tree[i].size()==0) {return 0;}}
vector<ll> u,v;
REP(i,0,N)
{
REP(j,0,tree[i].size()) {if(i>tree[i][j]) {continue;} u.pb(i); v.pb(tree[i][j]);}
}
REP(i,0,N-1) {if((pl){x[u[i]],y[u[i]]}>(pl){x[v[i]],y[v[i]]}) {swap(u[i],v[i]);}}
map<pair<pl,pl>,ll> m;
REP(i,0,N-1)
{
m[{{x[u[i]],y[u[i]]},{x[v[i]],y[v[i]]}}]=i;
m[{{x[v[i]],y[v[i]]},{x[u[i]],y[u[i]]}}]=i;
}
vector<pl> sat;
REP(i,0,N-1)
{
if(y[u[i]]!=y[v[i]]) {continue;}
if(m.find({{x[u[i]],y[u[i]]-2},{x[v[i]],y[v[i]]-2}})==m.end()) {continue;}
ll ind = m[{{x[u[i]],y[u[i]]-2},{x[v[i]],y[v[i]]-2}}];
//either i true or ind false
sat.pb({i+1,-ind-1});
}
REP(i,0,N-1)
{
if(x[u[i]]!=x[v[i]]) {continue;}
if(m.find({{x[u[i]]-2,y[u[i]]},{x[v[i]]-2,y[v[i]]}})==m.end()) {continue;}
ll ind = m[{{x[u[i]]-2,y[u[i]]},{x[v[i]]-2,y[v[i]]}}];
//either i true or ind false
sat.pb({i+1,-ind-1});
}
REP(i,0,N-1)
{
if(y[u[i]]!=y[v[i]]) {continue;}
if(m.find({{x[u[i]],y[u[i]]},{x[u[i]],y[u[i]]+2}})!=m.end())
{ll ind = m[{{x[u[i]],y[u[i]]},{x[u[i]],y[u[i]]+2}}]; sat.pb({-i-1,-ind-1});}
if(m.find({{x[u[i]],y[u[i]]},{x[u[i]],y[u[i]]-2}})!=m.end())
{ll ind = m[{{x[u[i]],y[u[i]]},{x[u[i]],y[u[i]]-2}}]; sat.pb({i+1,-ind-1});}
if(m.find({{x[v[i]],y[v[i]]},{x[v[i]],y[v[i]]+2}})!=m.end())
{ll ind = m[{{x[v[i]],y[v[i]]},{x[v[i]],y[v[i]]+2}}]; sat.pb({-i-1,ind+1});}
if(m.find({{x[v[i]],y[v[i]]},{x[v[i]],y[v[i]]-2}})!=m.end())
{ll ind = m[{{x[v[i]],y[v[i]]},{x[v[i]],y[v[i]]-2}}]; sat.pb({i+1,ind+1});}
}
vector<bool> ans = SAT2(N-1,sat);
if(ans.size()==0) {return 0;}
vector<ll> a,b;
REP(i,0,N-1)
{
if(x[u[i]]==x[v[i]]) //vertical
{
b.pb(min(y[u[i]],y[v[i]])+1);
if(ans[i])
{
a.pb(x[u[i]]+1);
}
else
{
a.pb(x[u[i]]-1);
}
}
else
{
a.pb(min(x[u[i]],x[v[i]])+1);
if(ans[i])
{
b.pb(y[u[i]]+1);
}
else
{
b.pb(y[u[i]]-1);
}
}
}
build(u,v,a,b);
return 1;
}
Compilation message
parks.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
5 | #pragma GCC optimization ("O3")
|
parks.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
6 | #pragma GCC optimization ("unroll-loops")
|
parks.cpp: In constructor 'Graph::Graph()':
parks.cpp:57:17: warning: unused variable 'N' [-Wunused-variable]
57 | Graph() {ll N=0LL;}
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
260 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
292 KB |
Output is correct |
23 |
Correct |
1399 ms |
164664 KB |
Output is correct |
24 |
Correct |
1 ms |
292 KB |
Output is correct |
25 |
Correct |
6 ms |
1300 KB |
Output is correct |
26 |
Correct |
4 ms |
1088 KB |
Output is correct |
27 |
Correct |
5 ms |
1216 KB |
Output is correct |
28 |
Correct |
463 ms |
67712 KB |
Output is correct |
29 |
Correct |
704 ms |
97500 KB |
Output is correct |
30 |
Correct |
1095 ms |
134440 KB |
Output is correct |
31 |
Correct |
1374 ms |
164392 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
288 KB |
Output is correct |
38 |
Correct |
0 ms |
296 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
292 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
3 ms |
972 KB |
Output is correct |
45 |
Correct |
457 ms |
79100 KB |
Output is correct |
46 |
Correct |
747 ms |
119180 KB |
Output is correct |
47 |
Correct |
798 ms |
119068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
260 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
292 KB |
Output is correct |
23 |
Correct |
1399 ms |
164664 KB |
Output is correct |
24 |
Correct |
1 ms |
292 KB |
Output is correct |
25 |
Correct |
6 ms |
1300 KB |
Output is correct |
26 |
Correct |
4 ms |
1088 KB |
Output is correct |
27 |
Correct |
5 ms |
1216 KB |
Output is correct |
28 |
Correct |
463 ms |
67712 KB |
Output is correct |
29 |
Correct |
704 ms |
97500 KB |
Output is correct |
30 |
Correct |
1095 ms |
134440 KB |
Output is correct |
31 |
Correct |
1374 ms |
164392 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
288 KB |
Output is correct |
38 |
Correct |
0 ms |
296 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
292 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
3 ms |
972 KB |
Output is correct |
45 |
Correct |
457 ms |
79100 KB |
Output is correct |
46 |
Correct |
747 ms |
119180 KB |
Output is correct |
47 |
Correct |
798 ms |
119068 KB |
Output is correct |
48 |
Correct |
1 ms |
272 KB |
Output is correct |
49 |
Correct |
0 ms |
296 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
288 KB |
Output is correct |
53 |
Correct |
1 ms |
288 KB |
Output is correct |
54 |
Correct |
0 ms |
204 KB |
Output is correct |
55 |
Correct |
1519 ms |
168912 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
7 ms |
1704 KB |
Output is correct |
58 |
Correct |
26 ms |
5288 KB |
Output is correct |
59 |
Correct |
12 ms |
3116 KB |
Output is correct |
60 |
Correct |
562 ms |
84964 KB |
Output is correct |
61 |
Correct |
811 ms |
118292 KB |
Output is correct |
62 |
Correct |
1152 ms |
141692 KB |
Output is correct |
63 |
Correct |
1319 ms |
167656 KB |
Output is correct |
64 |
Correct |
1 ms |
292 KB |
Output is correct |
65 |
Correct |
0 ms |
296 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
763 ms |
134100 KB |
Output is correct |
68 |
Correct |
778 ms |
133888 KB |
Output is correct |
69 |
Correct |
721 ms |
134036 KB |
Output is correct |
70 |
Correct |
5 ms |
1228 KB |
Output is correct |
71 |
Correct |
11 ms |
2276 KB |
Output is correct |
72 |
Correct |
494 ms |
80172 KB |
Output is correct |
73 |
Correct |
868 ms |
123992 KB |
Output is correct |
74 |
Correct |
1149 ms |
160048 KB |
Output is correct |
75 |
Correct |
1130 ms |
156364 KB |
Output is correct |
76 |
Correct |
742 ms |
135340 KB |
Output is correct |
77 |
Correct |
6 ms |
1652 KB |
Output is correct |
78 |
Correct |
11 ms |
2720 KB |
Output is correct |
79 |
Correct |
481 ms |
79924 KB |
Output is correct |
80 |
Correct |
816 ms |
122864 KB |
Output is correct |
81 |
Correct |
1148 ms |
159436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1319 ms |
174068 KB |
Output is correct |
21 |
Correct |
1290 ms |
173280 KB |
Output is correct |
22 |
Correct |
1401 ms |
174784 KB |
Output is correct |
23 |
Correct |
826 ms |
116308 KB |
Output is correct |
24 |
Correct |
179 ms |
33948 KB |
Output is correct |
25 |
Correct |
329 ms |
52256 KB |
Output is correct |
26 |
Correct |
289 ms |
52084 KB |
Output is correct |
27 |
Correct |
761 ms |
131292 KB |
Output is correct |
28 |
Correct |
762 ms |
131268 KB |
Output is correct |
29 |
Correct |
1276 ms |
131240 KB |
Output is correct |
30 |
Correct |
1227 ms |
131296 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
52 ms |
11496 KB |
Output is correct |
33 |
Correct |
84 ms |
17532 KB |
Output is correct |
34 |
Correct |
1390 ms |
175736 KB |
Output is correct |
35 |
Correct |
14 ms |
3020 KB |
Output is correct |
36 |
Correct |
81 ms |
13708 KB |
Output is correct |
37 |
Correct |
147 ms |
27164 KB |
Output is correct |
38 |
Correct |
420 ms |
68016 KB |
Output is correct |
39 |
Correct |
619 ms |
90640 KB |
Output is correct |
40 |
Correct |
881 ms |
119944 KB |
Output is correct |
41 |
Correct |
1079 ms |
142728 KB |
Output is correct |
42 |
Correct |
1402 ms |
165576 KB |
Output is correct |
43 |
Correct |
1 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
0 ms |
204 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
0 ms |
204 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
0 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
204 KB |
Output is correct |
53 |
Correct |
0 ms |
204 KB |
Output is correct |
54 |
Correct |
3 ms |
716 KB |
Output is correct |
55 |
Correct |
4 ms |
1100 KB |
Output is correct |
56 |
Correct |
427 ms |
79788 KB |
Output is correct |
57 |
Correct |
708 ms |
119284 KB |
Output is correct |
58 |
Correct |
753 ms |
119112 KB |
Output is correct |
59 |
Correct |
0 ms |
204 KB |
Output is correct |
60 |
Correct |
0 ms |
204 KB |
Output is correct |
61 |
Correct |
0 ms |
204 KB |
Output is correct |
62 |
Correct |
733 ms |
134144 KB |
Output is correct |
63 |
Correct |
691 ms |
134084 KB |
Output is correct |
64 |
Correct |
733 ms |
134076 KB |
Output is correct |
65 |
Correct |
6 ms |
1320 KB |
Output is correct |
66 |
Correct |
10 ms |
2224 KB |
Output is correct |
67 |
Correct |
484 ms |
80228 KB |
Output is correct |
68 |
Correct |
800 ms |
123948 KB |
Output is correct |
69 |
Correct |
1215 ms |
160256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
17 |
Correct |
889 ms |
133672 KB |
Output is correct |
18 |
Correct |
895 ms |
133460 KB |
Output is correct |
19 |
Correct |
1289 ms |
174124 KB |
Output is correct |
20 |
Correct |
1230 ms |
161456 KB |
Output is correct |
21 |
Correct |
937 ms |
126656 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
122 ms |
24892 KB |
Output is correct |
24 |
Correct |
26 ms |
5796 KB |
Output is correct |
25 |
Correct |
118 ms |
20384 KB |
Output is correct |
26 |
Correct |
195 ms |
32328 KB |
Output is correct |
27 |
Correct |
525 ms |
82052 KB |
Output is correct |
28 |
Correct |
681 ms |
100924 KB |
Output is correct |
29 |
Correct |
932 ms |
126400 KB |
Output is correct |
30 |
Correct |
1028 ms |
145068 KB |
Output is correct |
31 |
Correct |
1280 ms |
163792 KB |
Output is correct |
32 |
Correct |
1143 ms |
156348 KB |
Output is correct |
33 |
Correct |
688 ms |
135244 KB |
Output is correct |
34 |
Correct |
6 ms |
1632 KB |
Output is correct |
35 |
Correct |
10 ms |
2720 KB |
Output is correct |
36 |
Correct |
430 ms |
79852 KB |
Output is correct |
37 |
Correct |
740 ms |
122976 KB |
Output is correct |
38 |
Correct |
1068 ms |
159516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
299 ms |
66912 KB |
Output is correct |
10 |
Correct |
18 ms |
7052 KB |
Output is correct |
11 |
Correct |
96 ms |
35924 KB |
Output is correct |
12 |
Correct |
35 ms |
9740 KB |
Output is correct |
13 |
Correct |
32 ms |
11524 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
716 KB |
Output is correct |
16 |
Correct |
372 ms |
66052 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
260 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
292 KB |
Output is correct |
23 |
Correct |
1399 ms |
164664 KB |
Output is correct |
24 |
Correct |
1 ms |
292 KB |
Output is correct |
25 |
Correct |
6 ms |
1300 KB |
Output is correct |
26 |
Correct |
4 ms |
1088 KB |
Output is correct |
27 |
Correct |
5 ms |
1216 KB |
Output is correct |
28 |
Correct |
463 ms |
67712 KB |
Output is correct |
29 |
Correct |
704 ms |
97500 KB |
Output is correct |
30 |
Correct |
1095 ms |
134440 KB |
Output is correct |
31 |
Correct |
1374 ms |
164392 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
288 KB |
Output is correct |
38 |
Correct |
0 ms |
296 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
292 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
3 ms |
972 KB |
Output is correct |
45 |
Correct |
457 ms |
79100 KB |
Output is correct |
46 |
Correct |
747 ms |
119180 KB |
Output is correct |
47 |
Correct |
798 ms |
119068 KB |
Output is correct |
48 |
Correct |
1 ms |
272 KB |
Output is correct |
49 |
Correct |
0 ms |
296 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
288 KB |
Output is correct |
53 |
Correct |
1 ms |
288 KB |
Output is correct |
54 |
Correct |
0 ms |
204 KB |
Output is correct |
55 |
Correct |
1519 ms |
168912 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
7 ms |
1704 KB |
Output is correct |
58 |
Correct |
26 ms |
5288 KB |
Output is correct |
59 |
Correct |
12 ms |
3116 KB |
Output is correct |
60 |
Correct |
562 ms |
84964 KB |
Output is correct |
61 |
Correct |
811 ms |
118292 KB |
Output is correct |
62 |
Correct |
1152 ms |
141692 KB |
Output is correct |
63 |
Correct |
1319 ms |
167656 KB |
Output is correct |
64 |
Correct |
1 ms |
292 KB |
Output is correct |
65 |
Correct |
0 ms |
296 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
763 ms |
134100 KB |
Output is correct |
68 |
Correct |
778 ms |
133888 KB |
Output is correct |
69 |
Correct |
721 ms |
134036 KB |
Output is correct |
70 |
Correct |
5 ms |
1228 KB |
Output is correct |
71 |
Correct |
11 ms |
2276 KB |
Output is correct |
72 |
Correct |
494 ms |
80172 KB |
Output is correct |
73 |
Correct |
868 ms |
123992 KB |
Output is correct |
74 |
Correct |
1149 ms |
160048 KB |
Output is correct |
75 |
Correct |
1130 ms |
156364 KB |
Output is correct |
76 |
Correct |
742 ms |
135340 KB |
Output is correct |
77 |
Correct |
6 ms |
1652 KB |
Output is correct |
78 |
Correct |
11 ms |
2720 KB |
Output is correct |
79 |
Correct |
481 ms |
79924 KB |
Output is correct |
80 |
Correct |
816 ms |
122864 KB |
Output is correct |
81 |
Correct |
1148 ms |
159436 KB |
Output is correct |
82 |
Correct |
0 ms |
204 KB |
Output is correct |
83 |
Correct |
0 ms |
204 KB |
Output is correct |
84 |
Correct |
0 ms |
204 KB |
Output is correct |
85 |
Correct |
1319 ms |
174068 KB |
Output is correct |
86 |
Correct |
1290 ms |
173280 KB |
Output is correct |
87 |
Correct |
1401 ms |
174784 KB |
Output is correct |
88 |
Correct |
826 ms |
116308 KB |
Output is correct |
89 |
Correct |
179 ms |
33948 KB |
Output is correct |
90 |
Correct |
329 ms |
52256 KB |
Output is correct |
91 |
Correct |
289 ms |
52084 KB |
Output is correct |
92 |
Correct |
761 ms |
131292 KB |
Output is correct |
93 |
Correct |
762 ms |
131268 KB |
Output is correct |
94 |
Correct |
1276 ms |
131240 KB |
Output is correct |
95 |
Correct |
1227 ms |
131296 KB |
Output is correct |
96 |
Correct |
1 ms |
204 KB |
Output is correct |
97 |
Correct |
52 ms |
11496 KB |
Output is correct |
98 |
Correct |
84 ms |
17532 KB |
Output is correct |
99 |
Correct |
1390 ms |
175736 KB |
Output is correct |
100 |
Correct |
14 ms |
3020 KB |
Output is correct |
101 |
Correct |
81 ms |
13708 KB |
Output is correct |
102 |
Correct |
147 ms |
27164 KB |
Output is correct |
103 |
Correct |
420 ms |
68016 KB |
Output is correct |
104 |
Correct |
619 ms |
90640 KB |
Output is correct |
105 |
Correct |
881 ms |
119944 KB |
Output is correct |
106 |
Correct |
1079 ms |
142728 KB |
Output is correct |
107 |
Correct |
1402 ms |
165576 KB |
Output is correct |
108 |
Correct |
1 ms |
204 KB |
Output is correct |
109 |
Correct |
0 ms |
204 KB |
Output is correct |
110 |
Correct |
0 ms |
204 KB |
Output is correct |
111 |
Correct |
0 ms |
204 KB |
Output is correct |
112 |
Correct |
0 ms |
204 KB |
Output is correct |
113 |
Correct |
0 ms |
204 KB |
Output is correct |
114 |
Correct |
0 ms |
204 KB |
Output is correct |
115 |
Correct |
1 ms |
204 KB |
Output is correct |
116 |
Correct |
0 ms |
204 KB |
Output is correct |
117 |
Correct |
0 ms |
204 KB |
Output is correct |
118 |
Correct |
0 ms |
204 KB |
Output is correct |
119 |
Correct |
3 ms |
716 KB |
Output is correct |
120 |
Correct |
4 ms |
1100 KB |
Output is correct |
121 |
Correct |
427 ms |
79788 KB |
Output is correct |
122 |
Correct |
708 ms |
119284 KB |
Output is correct |
123 |
Correct |
753 ms |
119112 KB |
Output is correct |
124 |
Correct |
0 ms |
204 KB |
Output is correct |
125 |
Correct |
0 ms |
204 KB |
Output is correct |
126 |
Correct |
0 ms |
204 KB |
Output is correct |
127 |
Correct |
733 ms |
134144 KB |
Output is correct |
128 |
Correct |
691 ms |
134084 KB |
Output is correct |
129 |
Correct |
733 ms |
134076 KB |
Output is correct |
130 |
Correct |
6 ms |
1320 KB |
Output is correct |
131 |
Correct |
10 ms |
2224 KB |
Output is correct |
132 |
Correct |
484 ms |
80228 KB |
Output is correct |
133 |
Correct |
800 ms |
123948 KB |
Output is correct |
134 |
Correct |
1215 ms |
160256 KB |
Output is correct |
135 |
Correct |
889 ms |
133672 KB |
Output is correct |
136 |
Correct |
895 ms |
133460 KB |
Output is correct |
137 |
Correct |
1289 ms |
174124 KB |
Output is correct |
138 |
Correct |
1230 ms |
161456 KB |
Output is correct |
139 |
Correct |
937 ms |
126656 KB |
Output is correct |
140 |
Correct |
0 ms |
204 KB |
Output is correct |
141 |
Correct |
122 ms |
24892 KB |
Output is correct |
142 |
Correct |
26 ms |
5796 KB |
Output is correct |
143 |
Correct |
118 ms |
20384 KB |
Output is correct |
144 |
Correct |
195 ms |
32328 KB |
Output is correct |
145 |
Correct |
525 ms |
82052 KB |
Output is correct |
146 |
Correct |
681 ms |
100924 KB |
Output is correct |
147 |
Correct |
932 ms |
126400 KB |
Output is correct |
148 |
Correct |
1028 ms |
145068 KB |
Output is correct |
149 |
Correct |
1280 ms |
163792 KB |
Output is correct |
150 |
Correct |
1143 ms |
156348 KB |
Output is correct |
151 |
Correct |
688 ms |
135244 KB |
Output is correct |
152 |
Correct |
6 ms |
1632 KB |
Output is correct |
153 |
Correct |
10 ms |
2720 KB |
Output is correct |
154 |
Correct |
430 ms |
79852 KB |
Output is correct |
155 |
Correct |
740 ms |
122976 KB |
Output is correct |
156 |
Correct |
1068 ms |
159516 KB |
Output is correct |
157 |
Correct |
1 ms |
272 KB |
Output is correct |
158 |
Correct |
0 ms |
204 KB |
Output is correct |
159 |
Correct |
0 ms |
204 KB |
Output is correct |
160 |
Correct |
0 ms |
204 KB |
Output is correct |
161 |
Incorrect |
1421 ms |
178068 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |