# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119499 | tmwilliamlin168 | Printed Circuit Board (CEOI12_circuit) | C++14 | 41 ms | 5880 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;
#define ll long long
const int mxN=2e5;
int n, l, r;
ll x[mxN+1], y[mxN+1];
vector<int> v, s;
ll cp(int a, int b, int c) {
return (y[c]-y[a])*(x[b]-x[a])-(y[b]-y[a])*(x[c]-x[a]);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
while(n<3);
for(int i=0; i<n; ++i) {
cin >> x[i] >> y[i];
if(!i||cp(n, l, i)>0||!cp(n, l, i)&&x[i]<x[l])
l=i;
if(!i||cp(n, r, i)<0||!cp(n, r, i)&&x[i]<x[r])
r=i;
}
cout << s.size() << "\n";
sort(s.begin(), s.end());
for(int a : s)
cout << a+1 << " ";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |