답안 #340198

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
340198 2020-12-27T09:21:07 Z blue Printed Circuit Board (CEOI12_circuit) C++11
0 / 100
100 ms 7532 KB
#include <iostream>
#include <algorithm>
using namespace std;

int N;
int x[200001];
int y[200001];

bool slopesort(int a, int b)
{
    //return y[a]/x[a] < y[b]/x[b];
    if(y[a] * x[b] == y[b] * x[a]) return x[a] < x[b];
    return y[a] * x[b] < y[b] * x[a];
}

bool distsort(int a, int b)
{
    return x[a]^2 + y[a]^2 < x[b]^2 + y[b]^2;
}

int main()
{
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];

    int I[N+1];
    for(int i = 1; i <= N; i++) I[i] = i;
    sort(I+1, I+N+1, slopesort);

    int slope_pos[N+1];
    for(int i = 1; i <= N; i++) slope_pos[I[i]] = i;
    for(int i = 1; i <= N; i++) cout << slope_pos[i] << ' ';
    cout <<'\n';

}

Compilation message

circuit.cpp: In function 'bool distsort(int, int)':
circuit.cpp:18:19: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   18 |     return x[a]^2 + y[a]^2 < x[b]^2 + y[b]^2;
      |                 ~~^~~~~~
circuit.cpp:18:28: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
   18 |     return x[a]^2 + y[a]^2 < x[b]^2 + y[b]^2;
      |                          ~~^~~~~~
circuit.cpp:18:37: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   18 |     return x[a]^2 + y[a]^2 < x[b]^2 + y[b]^2;
      |                                   ~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 3 ms 364 KB Output isn't correct
4 Incorrect 4 ms 492 KB Output isn't correct
5 Incorrect 10 ms 620 KB Output isn't correct
6 Incorrect 10 ms 620 KB Output isn't correct
7 Incorrect 19 ms 1004 KB Output isn't correct
8 Incorrect 8 ms 620 KB Output isn't correct
9 Incorrect 6 ms 620 KB Output isn't correct
10 Incorrect 9 ms 748 KB Output isn't correct
11 Incorrect 11 ms 748 KB Output isn't correct
12 Incorrect 16 ms 1004 KB Output isn't correct
13 Incorrect 28 ms 1388 KB Output isn't correct
14 Incorrect 32 ms 1644 KB Output isn't correct
15 Incorrect 43 ms 2028 KB Output isn't correct
16 Incorrect 81 ms 3692 KB Output isn't correct
17 Incorrect 94 ms 3900 KB Output isn't correct
18 Execution timed out 169 ms 7276 KB Time limit exceeded
19 Execution timed out 175 ms 7276 KB Time limit exceeded
20 Execution timed out 193 ms 7532 KB Time limit exceeded