# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080455 | 2024-08-29T10:06:38 Z | kwongweng | Dragon 2 (JOI17_dragon2) | C++17 | 4000 ms | 36788 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]; } 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); 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 <= PI){ if (A <= d && d <= B){ cnt[c[i]][c[j]]++; } }else{ if (A > d || d > B){ 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2069 ms | 604 KB | Output is correct |
2 | Correct | 2066 ms | 604 KB | Output is correct |
3 | Correct | 2068 ms | 672 KB | Output is correct |
4 | Correct | 2062 ms | 5468 KB | Output is correct |
5 | Correct | 2117 ms | 36788 KB | Output is correct |
6 | Incorrect | 2033 ms | 35868 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4030 ms | 2140 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2069 ms | 604 KB | Output is correct |
2 | Correct | 2066 ms | 604 KB | Output is correct |
3 | Correct | 2068 ms | 672 KB | Output is correct |
4 | Correct | 2062 ms | 5468 KB | Output is correct |
5 | Correct | 2117 ms | 36788 KB | Output is correct |
6 | Incorrect | 2033 ms | 35868 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |