# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667590 | berr | Roads (CEOI20_roads) | C++17 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+37;
//1.st subtask all are vertical
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin>>n;
vector<array<int, 2>> node(2*n+1);
vector<array<int, 3>> q;
for(int i=1; i<=n*2; i+=2)
{
cin>>node[i][0]>>node[i][1];
cin>>node[i+1][0]>>node[i+1][1];
array<int, 2> a=node[i];
array<int, 2>b=node[i+1];
swap(a[0], a[1]);
swap(b[0], b[1]);
if(b<a)
{
q.push_back({node[i+1][0], node[i+1][1], i+1});
}
else
{
q.push_back({node[i][0], node[i][1], i});
}
}
sort(q.begin(), q.end());
for(int i=0; i<q.size()-1; i++)
{
int v=q[i][2];
int u=q[i+1][2];
cout<<node[v][0]<<" "<<node[v][1]<<" "<<node[u][0]<<" "<<node[u][1]<<"\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |