# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
403685 |
2021-05-13T11:15:43 Z |
errorgorn |
None (KOI16_laser) |
C++17 |
|
1351 ms |
2384 KB |
//雪花飄飄北風嘯嘯
//天地一片蒼茫
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
#define ld long double
const ld EPS=1e-11;
int n;
ii arr[1005];
ii brr[2005];
const int s=320,t=321;
const int BUF=105;
ld cost[325][325];
int cap[325][325];
ld sq(ld i){
return i*i;
}
ld dist(int i,int j){
return sqrtl(sq(arr[i].fi-brr[j].fi)+sq(arr[i].se-brr[j].se));
}
ld w[325];
int p[325];
bool inq[325];
queue<int> q;
void SPFA(int i,int j){
rep(x,0,325) w[x]=2e12;
w[i]=0;
inq[i]=true,q.push(i);
while (!q.empty()){
int node=q.front();
q.pop();
inq[node]=false;
rep(x,0,325) if (cap[node][x]>0 && w[x]-EPS>w[node]+cost[node][x]){
w[x]=w[node]+cost[node][x];
p[x]=node;
if (!inq[x]){
inq[x]=true,q.push(x);
}
}
}
}
vector<int> ans[105];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin.exceptions(ios::badbit | ios::failbit);
cin>>n;
rep(x,0,n) cin>>arr[x].fi>>arr[x].se;
rep(x,0,2*n) cin>>brr[x].fi>>brr[x].se;
rep(x,0,n){
rep(y,0,2*n){
cost[x][y+BUF]=dist(x,y);
cost[y+BUF][x]=-dist(x,y);
cap[x][y+BUF]=1;
}
}
rep(x,0,n) cap[s][x]=2;
rep(y,0,2*n) cap[y+BUF][t]=1;
rep(zzz,0,2*n){
SPFA(s,t);
vector<int> v={t};
while (v.back()!=s){
v.pub(p[v.back()]);
}
reverse(all(v));
//the cap is definitely 1
rep(x,0,sz(v)-1){
//cout<<"debug: "<<v[x]<<" "<<v[x+1]<<endl;
cap[v[x]][v[x+1]]--;
cap[v[x+1]][v[x]]++;
}
//cout<<endl;
}
rep(x,0,n){
rep(y,0,2*n){
if (cap[x][y+BUF]==0) ans[x].pub(y);
}
}
rep(x,0,n){
cout<<ans[x][0]+1<<" "<<ans[x][1]+1<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
214 ms |
1644 KB |
Output is correct |
2 |
Correct |
154 ms |
1308 KB |
Output is correct |
3 |
Correct |
188 ms |
1440 KB |
Output is correct |
4 |
Correct |
91 ms |
1612 KB |
Output is correct |
5 |
Correct |
93 ms |
1680 KB |
Output is correct |
6 |
Correct |
130 ms |
1868 KB |
Output is correct |
7 |
Correct |
40 ms |
1228 KB |
Output is correct |
8 |
Correct |
207 ms |
2216 KB |
Output is correct |
9 |
Correct |
98 ms |
1612 KB |
Output is correct |
10 |
Correct |
145 ms |
1996 KB |
Output is correct |
11 |
Correct |
1249 ms |
2252 KB |
Output is correct |
12 |
Correct |
1240 ms |
2252 KB |
Output is correct |
13 |
Correct |
1351 ms |
2252 KB |
Output is correct |
14 |
Correct |
1249 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
214 ms |
1644 KB |
Output is correct |
26 |
Correct |
154 ms |
1308 KB |
Output is correct |
27 |
Correct |
188 ms |
1440 KB |
Output is correct |
28 |
Correct |
91 ms |
1612 KB |
Output is correct |
29 |
Correct |
93 ms |
1680 KB |
Output is correct |
30 |
Correct |
130 ms |
1868 KB |
Output is correct |
31 |
Correct |
40 ms |
1228 KB |
Output is correct |
32 |
Correct |
207 ms |
2216 KB |
Output is correct |
33 |
Correct |
98 ms |
1612 KB |
Output is correct |
34 |
Correct |
145 ms |
1996 KB |
Output is correct |
35 |
Correct |
1249 ms |
2252 KB |
Output is correct |
36 |
Correct |
1240 ms |
2252 KB |
Output is correct |
37 |
Correct |
1351 ms |
2252 KB |
Output is correct |
38 |
Correct |
1249 ms |
2252 KB |
Output is correct |
39 |
Correct |
153 ms |
2248 KB |
Output is correct |
40 |
Correct |
144 ms |
2252 KB |
Output is correct |
41 |
Correct |
162 ms |
2252 KB |
Output is correct |
42 |
Correct |
156 ms |
2252 KB |
Output is correct |
43 |
Correct |
150 ms |
2252 KB |
Output is correct |
44 |
Correct |
184 ms |
2252 KB |
Output is correct |
45 |
Correct |
191 ms |
2252 KB |
Output is correct |
46 |
Correct |
158 ms |
2252 KB |
Output is correct |
47 |
Correct |
145 ms |
2252 KB |
Output is correct |
48 |
Correct |
147 ms |
2252 KB |
Output is correct |
49 |
Correct |
659 ms |
2252 KB |
Output is correct |
50 |
Correct |
675 ms |
2260 KB |
Output is correct |
51 |
Correct |
667 ms |
2252 KB |
Output is correct |
52 |
Correct |
696 ms |
2252 KB |
Output is correct |
53 |
Correct |
662 ms |
2372 KB |
Output is correct |
54 |
Correct |
666 ms |
2372 KB |
Output is correct |
55 |
Correct |
662 ms |
2260 KB |
Output is correct |
56 |
Correct |
674 ms |
2372 KB |
Output is correct |
57 |
Correct |
1129 ms |
2252 KB |
Output is correct |
58 |
Correct |
1104 ms |
2248 KB |
Output is correct |
59 |
Correct |
1064 ms |
2252 KB |
Output is correct |
60 |
Correct |
1108 ms |
2252 KB |
Output is correct |
61 |
Correct |
448 ms |
2252 KB |
Output is correct |
62 |
Correct |
455 ms |
2252 KB |
Output is correct |
63 |
Correct |
446 ms |
2252 KB |
Output is correct |
64 |
Correct |
176 ms |
2252 KB |
Output is correct |
65 |
Correct |
162 ms |
2252 KB |
Output is correct |
66 |
Correct |
191 ms |
2252 KB |
Output is correct |
67 |
Correct |
171 ms |
2252 KB |
Output is correct |
68 |
Correct |
141 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
214 ms |
1644 KB |
Output is correct |
26 |
Correct |
154 ms |
1308 KB |
Output is correct |
27 |
Correct |
188 ms |
1440 KB |
Output is correct |
28 |
Correct |
91 ms |
1612 KB |
Output is correct |
29 |
Correct |
93 ms |
1680 KB |
Output is correct |
30 |
Correct |
130 ms |
1868 KB |
Output is correct |
31 |
Correct |
40 ms |
1228 KB |
Output is correct |
32 |
Correct |
207 ms |
2216 KB |
Output is correct |
33 |
Correct |
98 ms |
1612 KB |
Output is correct |
34 |
Correct |
145 ms |
1996 KB |
Output is correct |
35 |
Correct |
1249 ms |
2252 KB |
Output is correct |
36 |
Correct |
1240 ms |
2252 KB |
Output is correct |
37 |
Correct |
1351 ms |
2252 KB |
Output is correct |
38 |
Correct |
1249 ms |
2252 KB |
Output is correct |
39 |
Correct |
153 ms |
2248 KB |
Output is correct |
40 |
Correct |
144 ms |
2252 KB |
Output is correct |
41 |
Correct |
162 ms |
2252 KB |
Output is correct |
42 |
Correct |
156 ms |
2252 KB |
Output is correct |
43 |
Correct |
150 ms |
2252 KB |
Output is correct |
44 |
Correct |
184 ms |
2252 KB |
Output is correct |
45 |
Correct |
191 ms |
2252 KB |
Output is correct |
46 |
Correct |
158 ms |
2252 KB |
Output is correct |
47 |
Correct |
145 ms |
2252 KB |
Output is correct |
48 |
Correct |
147 ms |
2252 KB |
Output is correct |
49 |
Correct |
659 ms |
2252 KB |
Output is correct |
50 |
Correct |
675 ms |
2260 KB |
Output is correct |
51 |
Correct |
667 ms |
2252 KB |
Output is correct |
52 |
Correct |
696 ms |
2252 KB |
Output is correct |
53 |
Correct |
662 ms |
2372 KB |
Output is correct |
54 |
Correct |
666 ms |
2372 KB |
Output is correct |
55 |
Correct |
662 ms |
2260 KB |
Output is correct |
56 |
Correct |
674 ms |
2372 KB |
Output is correct |
57 |
Correct |
1129 ms |
2252 KB |
Output is correct |
58 |
Correct |
1104 ms |
2248 KB |
Output is correct |
59 |
Correct |
1064 ms |
2252 KB |
Output is correct |
60 |
Correct |
1108 ms |
2252 KB |
Output is correct |
61 |
Correct |
448 ms |
2252 KB |
Output is correct |
62 |
Correct |
455 ms |
2252 KB |
Output is correct |
63 |
Correct |
446 ms |
2252 KB |
Output is correct |
64 |
Correct |
176 ms |
2252 KB |
Output is correct |
65 |
Correct |
162 ms |
2252 KB |
Output is correct |
66 |
Correct |
191 ms |
2252 KB |
Output is correct |
67 |
Correct |
171 ms |
2252 KB |
Output is correct |
68 |
Correct |
141 ms |
2252 KB |
Output is correct |
69 |
Runtime error |
4 ms |
2384 KB |
Execution killed with signal 11 |
70 |
Halted |
0 ms |
0 KB |
- |