Submission #127927

# Submission time Handle Problem Language Result Execution time Memory
127927 2019-07-10T08:36:13 Z 송준혁(#3112) Dragon 2 (JOI17_dragon2) C++14
15 / 100
158 ms 26788 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, LL> pii;

int N, Q;
int T[3030];
pii P[3030];
int ans[3030][3030];
pii S, E;

LL CCW(pii A, pii B, pii C){
    pii X = pii(B.first-A.first, B.second-A.second);
    pii Y = pii(C.first-A.first, C.second-A.second);
    return X.first*Y.second - X.second*Y.first;
}

int main(){
    int x, y;
    scanf("%d %*d", &N);
    for (int i=1; i<=N; i++) scanf("%lld %lld %d", &P[i].first, &P[i].second, &T[i]);
    scanf("%lld %lld %lld %lld", &S.first, &S.second, &E.first, &E.second);
    for (int i=1; i<=N; i++) for (int j=1; j<=N; j++){
        bool t1 = CCW(P[i], P[j], S) > 0;
        bool t2 = CCW(P[i], P[j], E) > 0;
        if ((t1 && t2) || (!t1 && !t2)) continue;
        t1 = CCW(P[i], S, E) > 0;
        t2 = CCW(P[i], S, P[j]) > 0;
        if ((t1 && t2) || (!t1 && !t2)) ans[T[i]][T[j]]++;
    }
    scanf("%d", &Q);
    while (Q--){
        scanf("%d %d", &x, &y);
        printf("%d\n", ans[x][y]);
    }
    return 0;
}

Compilation message

dragon2.cpp: In function 'int main()':
dragon2.cpp:21:84: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
     for (int i=1; i<=N; i++) scanf("%lld %lld %d", &P[i].first, &P[i].second, &T[i]);
                                                    ~~~~~~~~~~~                     ^
dragon2.cpp:22:74: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
     scanf("%lld %lld %lld %lld", &S.first, &S.second, &E.first, &E.second);
                                  ~~~~~~~~                                ^
dragon2.cpp:22:74: warning: format '%lld' expects argument of type 'long long int*', but argument 4 has type 'int*' [-Wformat=]
dragon2.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %*d", &N);
     ~~~~~^~~~~~~~~~~~~~
dragon2.cpp:21:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i=1; i<=N; i++) scanf("%lld %lld %d", &P[i].first, &P[i].second, &T[i]);
                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld %lld", &S.first, &S.second, &E.first, &E.second);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &Q);
     ~~~~~^~~~~~~~~~
dragon2.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 93 ms 376 KB Output is correct
2 Correct 72 ms 504 KB Output is correct
3 Correct 97 ms 952 KB Output is correct
4 Correct 108 ms 8784 KB Output is correct
5 Correct 158 ms 26788 KB Output is correct
6 Correct 30 ms 2292 KB Output is correct
7 Correct 31 ms 2296 KB Output is correct
8 Correct 96 ms 496 KB Output is correct
9 Correct 47 ms 480 KB Output is correct
10 Correct 46 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 93 ms 376 KB Output is correct
2 Correct 72 ms 504 KB Output is correct
3 Correct 97 ms 952 KB Output is correct
4 Correct 108 ms 8784 KB Output is correct
5 Correct 158 ms 26788 KB Output is correct
6 Correct 30 ms 2292 KB Output is correct
7 Correct 31 ms 2296 KB Output is correct
8 Correct 96 ms 496 KB Output is correct
9 Correct 47 ms 480 KB Output is correct
10 Correct 46 ms 468 KB Output is correct
11 Runtime error 6 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -