답안 #119499

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119499 2019-06-21T10:33:39 Z tmwilliamlin168 Printed Circuit Board (CEOI12_circuit) C++14
0 / 100
41 ms 5880 KB
#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

circuit.cpp: In function 'int main()':
circuit.cpp:23:37: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(!i||cp(n, l, i)>0||!cp(n, l, i)&&x[i]<x[l])
                         ~~~~~~~~~~~~^~~~~~~~~~~
circuit.cpp:25:37: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(!i||cp(n, r, i)<0||!cp(n, r, i)&&x[i]<x[r])
                         ~~~~~~~~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 3 ms 384 KB Output isn't correct
5 Incorrect 4 ms 640 KB Output isn't correct
6 Incorrect 3 ms 512 KB Output isn't correct
7 Incorrect 6 ms 896 KB Output isn't correct
8 Incorrect 4 ms 512 KB Output isn't correct
9 Incorrect 3 ms 512 KB Output isn't correct
10 Incorrect 4 ms 640 KB Output isn't correct
11 Incorrect 4 ms 640 KB Output isn't correct
12 Incorrect 5 ms 768 KB Output isn't correct
13 Incorrect 8 ms 1152 KB Output isn't correct
14 Incorrect 9 ms 1280 KB Output isn't correct
15 Incorrect 11 ms 1664 KB Output isn't correct
16 Incorrect 20 ms 3072 KB Output isn't correct
17 Incorrect 25 ms 3192 KB Output isn't correct
18 Incorrect 39 ms 5752 KB Output isn't correct
19 Incorrect 38 ms 5624 KB Output isn't correct
20 Incorrect 41 ms 5880 KB Output isn't correct