답안 #1080467

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080467 2024-08-29T10:13:30 Z kwongweng Dragon 2 (JOI17_dragon2) C++17
0 / 100
4000 ms 35924 KB
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
#define fi first
#define se second
#define ms memset
typedef complex<ld> pt;


int main(){
    ios::sync_with_stdio(false);
    cout.tie(0); cin.tie(0);
    int n,m; cin>>n>>m;
    int cnt[m+1][m+1]; ms(cnt,0,sizeof(cnt));
    vector<pt> p(n); vi c(n);
    FOR(i,0,n){
        int a,b; cin>>a>>b;
        p[i] = {a,b};
        cin>>c[i];
    }
    ld eps = 1e-9;
    ll d1,e1,d2,e2; cin>>d1>>e1>>d2>>e2;
    pt d = {d1,e1}, e = {d2,e2};
    pt haha = {-1,0};
    ld PI = arg(haha);
    //cout<<setprecision(12)<<PI;
    FOR(i,0,n){
        FOR(j,0,n){
            if (i==j) continue;
            ld a = arg(d-p[i]);
            ld b = arg(e-p[i]);
            ld d = arg(p[j]-p[i]);
            ld A = min(a,b), B = max(a,b);
            if (B-A+eps < PI){
                if (A+eps < d && d+eps < B){
                    cnt[c[i]][c[j]]++;
                }
            }else{
                if (A > d+eps || d > B+eps){
                    cnt[c[i]][c[j]]++;
                }
            }
        }
    }
    //cout<<PI<<"\n";
    int q; cin>>q;
    FOR(i,0,q){
        int f,g; cin>>f>>g;
        cout<<cnt[f][g]<<"\n";
    }
    return 0;
}

Compilation message

dragon2.cpp: In function 'int main()':
dragon2.cpp:24:17: warning: narrowing conversion of 'a' from 'int' to 'long double' [-Wnarrowing]
   24 |         p[i] = {a,b};
      |                 ^
dragon2.cpp:24:19: warning: narrowing conversion of 'b' from 'int' to 'long double' [-Wnarrowing]
   24 |         p[i] = {a,b};
      |                   ^
dragon2.cpp:29:13: warning: narrowing conversion of 'd1' from 'll' {aka 'long long int'} to 'long double' [-Wnarrowing]
   29 |     pt d = {d1,e1}, e = {d2,e2};
      |             ^~
dragon2.cpp:29:16: warning: narrowing conversion of 'e1' from 'll' {aka 'long long int'} to 'long double' [-Wnarrowing]
   29 |     pt d = {d1,e1}, e = {d2,e2};
      |                ^~
dragon2.cpp:29:26: warning: narrowing conversion of 'd2' from 'll' {aka 'long long int'} to 'long double' [-Wnarrowing]
   29 |     pt d = {d1,e1}, e = {d2,e2};
      |                          ^~
dragon2.cpp:29:29: warning: narrowing conversion of 'e2' from 'll' {aka 'long long int'} to 'long double' [-Wnarrowing]
   29 |     pt d = {d1,e1}, e = {d2,e2};
      |                             ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2047 ms 536 KB Output is correct
2 Correct 2085 ms 540 KB Output is correct
3 Correct 2059 ms 568 KB Output is correct
4 Correct 2071 ms 4452 KB Output is correct
5 Correct 2148 ms 35924 KB Output is correct
6 Incorrect 2050 ms 35676 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4053 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2047 ms 536 KB Output is correct
2 Correct 2085 ms 540 KB Output is correct
3 Correct 2059 ms 568 KB Output is correct
4 Correct 2071 ms 4452 KB Output is correct
5 Correct 2148 ms 35924 KB Output is correct
6 Incorrect 2050 ms 35676 KB Output isn't correct
7 Halted 0 ms 0 KB -