# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
53260 |
2018-06-29T06:11:06 Z |
윤교준(#1402) |
Adriatic (CEOI13_adriatic) |
C++11 |
|
2000 ms |
6952 KB |
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
//#define rf(x) (x)=0;while(*p<48)im=*p=='-';while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);if(im)(x)=-(x);
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define cb(x) (x)=(!(x))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
#define INFST (0x7f7f7f7f)
#define INFLLST (0x7f7f7f7f7f7f7f7fll)
using namespace std;
typedef long long ll;
typedef __int128_t lll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
typedef complex<ld> base;
const ld EPS = (ld)1e-7;
const ld PI = acos(0) * 2;
bool isZero(const ld& x) { return abs(x) <= EPS; }
int sign(const ld& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); }
ll gcd(ll a, ll b) { for(;b;a%=b,swap(a,b)){} return abs(a); }
pll operator + (const pll& a, const pll& b) { return pll(a.first+b.first, a.second+b.second); }
pll operator - (const pll& a, const pll& b) { return pll(a.first-b.first, a.second-b.second); }
pll operator * (const pll& a, const ll& b) { return pll(a.first*b, a.second*b); }
ll operator * (const pll& a, const pll& b) { return a.first*b.second - b.first*a.second; }
ll ccw(const pll& a, const pll& b, const pll& c) { return a*b + b*c + c*a; }
int rd(int s, int e) { return rand()%(e-s+1) + s; }
void fg(vector<int> G[], int a, int b) { G[a].pb(b); G[b].pb(a); }
void fg(vector<pii> G[], int a, int b, int c) { G[a].pb({b, c}); G[b].pb({a, c}); }
const int MAXN = 5005;
vector<int> G[MAXN];
int Y[MAXN], X[MAXN];
int d[MAXN];
int N;
int main() {
ios::sync_with_stdio(false);
cin >> N;
for(int i = 1; i <= N; i++) cin >> Y[i] >> X[i];
for(int i = 1; i <= N; i++) for(int j = 1; j <= N; j++)
if((X[i] < X[j] && Y[i] < Y[j]) || (X[i] > X[j] && Y[i] > Y[j]))
G[i].pb(j);
for(int i = 1; i <= N; i++) {
fill(d, d+N+1, INF);
d[i] = 0;
queue<int> Q; Q.push(i);
for(int idx, dst; !Q.empty(); Q.pop()) {
idx = Q.front(); dst = d[idx]+1;
for(int v : G[idx]) {
if(d[v] <= dst) continue;
d[v] = dst;
Q.push(v);
}
}
ll ret = 0;
for(int j = 1; j <= N; j++)
ret += d[j];
printf("%lld\n", ret);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
580 KB |
Output is correct |
3 |
Correct |
2 ms |
580 KB |
Output is correct |
4 |
Correct |
3 ms |
628 KB |
Output is correct |
5 |
Correct |
3 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
319 ms |
1332 KB |
Output is correct |
2 |
Correct |
1993 ms |
6892 KB |
Output is correct |
3 |
Correct |
134 ms |
6892 KB |
Output is correct |
4 |
Correct |
1893 ms |
6952 KB |
Output is correct |
5 |
Correct |
1777 ms |
6952 KB |
Output is correct |
6 |
Correct |
140 ms |
6952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2080 ms |
6952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
6952 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 |
Runtime error |
9 ms |
6952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |