# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
27284 |
2017-07-12T07:04:06 Z |
상수조아(#1141) |
City (JOI17_city) |
C++ |
|
607 ms |
56960 KB |
#include "Encoder.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>
using namespace std;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;
vector <int> E[250010];
int tm, S[250050], D[250050];
void dfs(int x, int fa) {
S[x] = ++tm;
for(int e : E[x]) if(e != fa) dfs(e, x);
D[x] = tm;
}
ll sq(int x) { return (ll)x * (x+1) / 2; }
ll get(int s, int d) {
--s; --d;
return sq(250000) - sq(250000-s) + (d-s);
}
void Encode(int N, int A[], int B[])
{
rep(i, N-1) E[A[i]].pb(B[i]), E[B[i]].pb(A[i]);
dfs(0, -1);
rep(i, N) Code(i, get(S[i], D[i]));
}
#include "Device.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>
using namespace std;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;
ll A[250050];
void InitDevice()
{
for(int i=1;i<=250000;i++) A[i] = A[i-1] + (250001 - i);
}
pii get(ll X) {
int s = (int)(upper_bound(A+1, A+250001, X) - A - 1);
int d = s + (X - A[s]);
return pii(s, d);
}
int Answer(long long S, long long T)
{
pii ps = get(S);
int sx = ps.Fi, sy = ps.Se;
pii pt = get(T);
int tx = pt.Fi, ty = pt.Se;
if(sx <= tx && ty <= sy) return 1;
if(tx <= sx && sy <= ty) return 0;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
12288 KB |
Output is correct |
2 |
Correct |
10 ms |
12288 KB |
Output is correct |
3 |
Correct |
12 ms |
12288 KB |
Output is correct |
4 |
Correct |
9 ms |
12544 KB |
Output is correct |
5 |
Correct |
10 ms |
12288 KB |
Output is correct |
6 |
Correct |
10 ms |
12544 KB |
Output is correct |
7 |
Correct |
10 ms |
12544 KB |
Output is correct |
8 |
Correct |
10 ms |
12288 KB |
Output is correct |
9 |
Correct |
10 ms |
12288 KB |
Output is correct |
10 |
Correct |
11 ms |
12488 KB |
Output is correct |
11 |
Correct |
10 ms |
12288 KB |
Output is correct |
12 |
Correct |
9 ms |
12288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
193 ms |
19512 KB |
Output is correct - L = 174506049 |
2 |
Correct |
189 ms |
19440 KB |
Output is correct - L = 174256747 |
3 |
Correct |
189 ms |
19384 KB |
Output is correct - L = 174506049 |
4 |
Correct |
191 ms |
19440 KB |
Output is correct - L = 174506049 |
5 |
Partially correct |
581 ms |
55256 KB |
Output is partially correct - L = 31250124999 |
6 |
Partially correct |
555 ms |
55272 KB |
Output is partially correct - L = 31250124999 |
7 |
Partially correct |
586 ms |
55208 KB |
Output is partially correct - L = 31250124999 |
8 |
Partially correct |
601 ms |
54632 KB |
Output is partially correct - L = 31250124999 |
9 |
Partially correct |
503 ms |
56616 KB |
Output is partially correct - L = 31250124999 |
10 |
Partially correct |
496 ms |
56960 KB |
Output is partially correct - L = 31250124999 |
11 |
Partially correct |
475 ms |
56608 KB |
Output is partially correct - L = 31250124999 |
12 |
Partially correct |
487 ms |
56608 KB |
Output is partially correct - L = 31250124999 |
13 |
Partially correct |
519 ms |
55928 KB |
Output is partially correct - L = 31250124999 |
14 |
Partially correct |
531 ms |
55456 KB |
Output is partially correct - L = 31250124999 |
15 |
Correct |
193 ms |
19560 KB |
Output is correct - L = 174506049 |
16 |
Correct |
187 ms |
19568 KB |
Output is correct - L = 174506049 |
17 |
Correct |
188 ms |
19456 KB |
Output is correct - L = 174506049 |
18 |
Partially correct |
545 ms |
55968 KB |
Output is partially correct - L = 31250124999 |
19 |
Partially correct |
529 ms |
55512 KB |
Output is partially correct - L = 31250124999 |
20 |
Partially correct |
545 ms |
55664 KB |
Output is partially correct - L = 31250124999 |
21 |
Partially correct |
528 ms |
55616 KB |
Output is partially correct - L = 31250124999 |
22 |
Partially correct |
568 ms |
55584 KB |
Output is partially correct - L = 31250124999 |
23 |
Partially correct |
578 ms |
55408 KB |
Output is partially correct - L = 31250124999 |
24 |
Partially correct |
586 ms |
55240 KB |
Output is partially correct - L = 31250124999 |
25 |
Partially correct |
581 ms |
55424 KB |
Output is partially correct - L = 31250124999 |
26 |
Partially correct |
607 ms |
55216 KB |
Output is partially correct - L = 31250124999 |
27 |
Partially correct |
605 ms |
55216 KB |
Output is partially correct - L = 31250124999 |