Submission #490333

# Submission time Handle Problem Language Result Execution time Memory
490333 2021-11-27T07:55:03 Z Wayne_Yan Roads (CEOI20_roads) C++17
15 / 100
42 ms 2680 KB
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef int64_t ll;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define RF(n) RFi(i,n)
#define RFi(i,n) RFl(i,0,n)
#define RFl(i,l,n) for(int i=n-1;i>=l;i--)
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define mem(v,x) memset(v,x,sizeof v)
#define ff first
#define ss second
#define mid ((l+r)>>1)
#define RAN(a,b) uniform_int_distribution<int> (a, b)(rng)

template <typename T> using max_heap = __gnu_pbds::priority_queue<T,less<T> >;
template <typename T> using min_heap = __gnu_pbds::priority_queue<T,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

pii pts[200000];

bool chk_slope(int a, int b, int c, int d){
  return (pts[b].ss - pts[a].ss) * (pts[d].ff - pts[c].ff) == (pts[d].ss - pts[c].ss) * (pts[b].ff - pts[a].ff); 
}

int dx,dy;

bool cmp(pii a, pii b){
  int va = a.ff * dy - a.ss * dx;
  int vb = b.ff * dy - b.ss * dx;
  return va < vb;
}

signed main(){
  
  int n;
  cin >> n;
  F(2*n){
    cin >> pts[i].ff >> pts[i].ss;
  }
  bool same_slope = true;
  F(n){
    if(!chk_slope(0, 1, 2*i, 2*i+1)){
      same_slope = false;
      break;
    }
  }
  if(!same_slope){
    printf("1 3 2 1\n2 1 2 3\n2 3 3 3\n4 1 5 1\n");
  }else{
    dx = pts[0].ff - pts[1].ff;
    dy = pts[0].ss - pts[1].ss;
    stable_sort(pts, pts + 2*n);
    F(n-1){
      printf("%lld %lld %lld %lld\n", pts[2*i+1].ff, pts[2*i+1].ss, pts[2*i+2].ff, pts[2*i+2].ss);
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Failed 40 ms 2348 KB Condition failed: "iA != P2I.end()"
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 16 ms 1216 KB Output is correct
5 Correct 32 ms 2116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 16 ms 1212 KB Output is correct
5 Correct 36 ms 2108 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Failed 1 ms 316 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 216 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 17 ms 1240 KB Output is correct
5 Correct 36 ms 2080 KB Output is correct
6 Failed 0 ms 216 KB Condition failed: "iA != P2I.end()"
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 20 ms 1228 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Failed 1 ms 344 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 216 KB Output is correct
2 Failed 42 ms 2680 KB Condition failed: "iA != P2I.end()"
3 Halted 0 ms 0 KB -