답안 #386131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
386131 2021-04-05T17:03:39 Z AmineWeslati Aliens (IOI16_aliens) C++14
60 / 100
2000 ms 354948 KB
//Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
//constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
ll random(ll a, ll b){
    return a + rng() % (b - a + 1);
}
#ifndef LOCAL  
#define cerr if(false) cerr
#endif
#define dbg(x) cerr << #x << " : " << x << endl; 
#define dbgs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////

#ifndef LOCAL
#include "aliens.h"
#endif

int N,M,K; 
V<V<ll>>dp;
vpi vec; 

bool cmp(pi a, pi b){
	if(a.fi!=b.fi) return a.fi<b.fi;
	return a.se>b.se;
}

void filter(){ //change N and segs
	sort(all(vec),cmp);

	vpi vec2;
	int mxr=-1;
	for(auto x: vec){
		int l=x.fi,r=x.se;
		if(r>mxr) vec2.pb(x);
		ckmax(mxr,r);
	}

	vec.assign(all(vec2));
	N=sz(vec);	
}

ll sq(ll v){
	return v*v;
}


////convex hull stuff

struct line{
	ll a,b; 
}; 
deque<line>st; 

ld inter(line x, line y){
	return ((ld)(y.b-x.b))/(x.a-y.a);
}

void add(ll a, ll b){
	while(sz(st)>=2 && 
		inter(st[sz(st)-1],line{a,b})<=inter(st[sz(st)-1],st[sz(st)-2]))
			st.pop_back();
	st.pb({a,b});
}
ll query(ll x){
	while(sz(st)>=2 && inter(st[0],st[1])<x) 
		st.pop_front();
	ll a=st[0].a,b=st[0].b; 
	return a*x+b;
}

////////////////////////

ll take_photos(int n, int m, int k, vi rr, vi cc) {
	tie(N,M,K)={n,m,k};
	FOR(i,0,N){
		vec.eb(min(rr[i],cc[i]),max(rr[i],cc[i]));
	}
	filter();

	dp.resize(N+1);
	FOR(i,0,N+1) dp[i].assign(K+1,INF);
	FOR(j,0,K+1) dp[0][j]=0;

	FOR(j,1,K+1){
		st.clear(); //reinitialize convex hull
		FOR(i,1,N+1){
			int l=vec[i-1].fi,r=vec[i-1].se;
			ll a=-2*(l-1); 
			ll b=dp[i-1][j-1] + sq(l-1); 
			if(i>=2) b-=sq(max(0,vec[i-2].se-vec[i-1].fi+1));

			add(a,b);
			dp[i][j]=sq(vec[i-1].se)+query(vec[i-1].se);
		}
	}
	return dp[N][K];
}


#ifdef LOCAL
int main() {
    boost; IO();

    int N,M,K; cin>>N>>M>>K;
    vi x(N),y(N);
    FOR(i,0,N) cin>>x[i]>>y[i];
    //FOR(i,0,N) cin>>y[i];
    cout << take_photos(N,M,K,x,y) << endl;

    return 0;
}
#endif
//Change your approach 

/*
5 7 2
0 4 4 4 4
3 4 6 5 6
*/

/*
2 6 2
1 4
4 1
*/

Compilation message

aliens.cpp: In function 'void filter()':
aliens.cpp:73:7: warning: unused variable 'l' [-Wunused-variable]
   73 |   int l=x.fi,r=x.se;
      |       ^
aliens.cpp: In function 'll take_photos(int, int, int, vi, vi)':
aliens.cpp:127:22: warning: unused variable 'r' [-Wunused-variable]
  127 |    int l=vec[i-1].fi,r=vec[i-1].se;
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 1 ms 364 KB Correct answer: answer = 4
4 Correct 1 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 2 ms 364 KB Correct answer: answer = 210
7 Correct 1 ms 364 KB Correct answer: answer = 88
8 Correct 1 ms 364 KB Correct answer: answer = 7696
9 Correct 1 ms 364 KB Correct answer: answer = 1
10 Correct 1 ms 364 KB Correct answer: answer = 2374
11 Correct 1 ms 364 KB Correct answer: answer = 9502
12 Correct 1 ms 364 KB Correct answer: answer = 49
13 Correct 1 ms 364 KB Correct answer: answer = 151
14 Correct 2 ms 364 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 364 KB Correct answer: answer = 7550
17 Correct 1 ms 364 KB Correct answer: answer = 10000
18 Correct 1 ms 384 KB Correct answer: answer = 10000
19 Correct 1 ms 364 KB Correct answer: answer = 624
20 Correct 1 ms 364 KB Correct answer: answer = 10000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 1
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 2 ms 364 KB Correct answer: answer = 1
4 Correct 1 ms 364 KB Correct answer: answer = 5
5 Correct 1 ms 364 KB Correct answer: answer = 41
6 Correct 1 ms 364 KB Correct answer: answer = 71923
7 Correct 2 ms 364 KB Correct answer: answer = 77137
8 Correct 6 ms 1132 KB Correct answer: answer = 764
9 Correct 1 ms 364 KB Correct answer: answer = 250000
10 Correct 12 ms 2284 KB Correct answer: answer = 500
11 Correct 1 ms 364 KB Correct answer: answer = 32
12 Correct 2 ms 364 KB Correct answer: answer = 130050
13 Correct 2 ms 492 KB Correct answer: answer = 5110
14 Correct 1 ms 364 KB Correct answer: answer = 2626
15 Correct 2 ms 492 KB Correct answer: answer = 796
16 Correct 2 ms 492 KB Correct answer: answer = 7580
17 Correct 5 ms 876 KB Correct answer: answer = 1904
18 Correct 1 ms 364 KB Correct answer: answer = 996004
19 Correct 2 ms 364 KB Correct answer: answer = 38817
20 Correct 4 ms 620 KB Correct answer: answer = 4096
21 Correct 2 ms 364 KB Correct answer: answer = 1
22 Correct 1 ms 364 KB Correct answer: answer = 1
23 Correct 5 ms 876 KB Correct answer: answer = 2040
24 Correct 1 ms 364 KB Correct answer: answer = 2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 1 ms 364 KB Correct answer: answer = 4
4 Correct 1 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 2 ms 364 KB Correct answer: answer = 210
7 Correct 1 ms 364 KB Correct answer: answer = 88
8 Correct 1 ms 364 KB Correct answer: answer = 7696
9 Correct 1 ms 364 KB Correct answer: answer = 1
10 Correct 1 ms 364 KB Correct answer: answer = 2374
11 Correct 1 ms 364 KB Correct answer: answer = 9502
12 Correct 1 ms 364 KB Correct answer: answer = 49
13 Correct 1 ms 364 KB Correct answer: answer = 151
14 Correct 2 ms 364 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 364 KB Correct answer: answer = 7550
17 Correct 1 ms 364 KB Correct answer: answer = 10000
18 Correct 1 ms 384 KB Correct answer: answer = 10000
19 Correct 1 ms 364 KB Correct answer: answer = 624
20 Correct 1 ms 364 KB Correct answer: answer = 10000
21 Correct 1 ms 364 KB Correct answer: answer = 1
22 Correct 1 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 364 KB Correct answer: answer = 1
24 Correct 1 ms 364 KB Correct answer: answer = 5
25 Correct 1 ms 364 KB Correct answer: answer = 41
26 Correct 1 ms 364 KB Correct answer: answer = 71923
27 Correct 2 ms 364 KB Correct answer: answer = 77137
28 Correct 6 ms 1132 KB Correct answer: answer = 764
29 Correct 1 ms 364 KB Correct answer: answer = 250000
30 Correct 12 ms 2284 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 2 ms 364 KB Correct answer: answer = 130050
33 Correct 2 ms 492 KB Correct answer: answer = 5110
34 Correct 1 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 492 KB Correct answer: answer = 796
36 Correct 2 ms 492 KB Correct answer: answer = 7580
37 Correct 5 ms 876 KB Correct answer: answer = 1904
38 Correct 1 ms 364 KB Correct answer: answer = 996004
39 Correct 2 ms 364 KB Correct answer: answer = 38817
40 Correct 4 ms 620 KB Correct answer: answer = 4096
41 Correct 2 ms 364 KB Correct answer: answer = 1
42 Correct 1 ms 364 KB Correct answer: answer = 1
43 Correct 5 ms 876 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 364 KB Correct answer: answer = 4
46 Correct 1 ms 364 KB Correct answer: answer = 9
47 Correct 1 ms 364 KB Correct answer: answer = 9
48 Correct 1 ms 364 KB Correct answer: answer = 21
49 Correct 1 ms 364 KB Correct answer: answer = 71
50 Correct 1 ms 364 KB Correct answer: answer = 77
51 Correct 1 ms 364 KB Correct answer: answer = 400
52 Correct 2 ms 364 KB Correct answer: answer = 996004
53 Correct 2 ms 364 KB Correct answer: answer = 997310
54 Correct 1 ms 364 KB Correct answer: answer = 990781
55 Correct 1 ms 364 KB Correct answer: answer = 996545
56 Correct 2 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 1 ms 364 KB Correct answer: answer = 63501
59 Correct 2 ms 492 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 3 ms 748 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 11 ms 2284 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 2 ms 364 KB Correct answer: answer = 250000
67 Correct 1 ms 364 KB Correct answer: answer = 250000
68 Correct 1 ms 364 KB Correct answer: answer = 1000000
69 Correct 1 ms 364 KB Correct answer: answer = 994009
70 Correct 2 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 492 KB Correct answer: answer = 25454
72 Correct 3 ms 748 KB Correct answer: answer = 1504
73 Correct 1 ms 364 KB Correct answer: answer = 37486
74 Correct 2 ms 492 KB Correct answer: answer = 4284
75 Correct 3 ms 492 KB Correct answer: answer = 158008
76 Correct 2 ms 492 KB Correct answer: answer = 51860
77 Correct 1 ms 364 KB Correct answer: answer = 12985
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 1 ms 364 KB Correct answer: answer = 4
4 Correct 1 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 2 ms 364 KB Correct answer: answer = 210
7 Correct 1 ms 364 KB Correct answer: answer = 88
8 Correct 1 ms 364 KB Correct answer: answer = 7696
9 Correct 1 ms 364 KB Correct answer: answer = 1
10 Correct 1 ms 364 KB Correct answer: answer = 2374
11 Correct 1 ms 364 KB Correct answer: answer = 9502
12 Correct 1 ms 364 KB Correct answer: answer = 49
13 Correct 1 ms 364 KB Correct answer: answer = 151
14 Correct 2 ms 364 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 364 KB Correct answer: answer = 7550
17 Correct 1 ms 364 KB Correct answer: answer = 10000
18 Correct 1 ms 384 KB Correct answer: answer = 10000
19 Correct 1 ms 364 KB Correct answer: answer = 624
20 Correct 1 ms 364 KB Correct answer: answer = 10000
21 Correct 1 ms 364 KB Correct answer: answer = 1
22 Correct 1 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 364 KB Correct answer: answer = 1
24 Correct 1 ms 364 KB Correct answer: answer = 5
25 Correct 1 ms 364 KB Correct answer: answer = 41
26 Correct 1 ms 364 KB Correct answer: answer = 71923
27 Correct 2 ms 364 KB Correct answer: answer = 77137
28 Correct 6 ms 1132 KB Correct answer: answer = 764
29 Correct 1 ms 364 KB Correct answer: answer = 250000
30 Correct 12 ms 2284 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 2 ms 364 KB Correct answer: answer = 130050
33 Correct 2 ms 492 KB Correct answer: answer = 5110
34 Correct 1 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 492 KB Correct answer: answer = 796
36 Correct 2 ms 492 KB Correct answer: answer = 7580
37 Correct 5 ms 876 KB Correct answer: answer = 1904
38 Correct 1 ms 364 KB Correct answer: answer = 996004
39 Correct 2 ms 364 KB Correct answer: answer = 38817
40 Correct 4 ms 620 KB Correct answer: answer = 4096
41 Correct 2 ms 364 KB Correct answer: answer = 1
42 Correct 1 ms 364 KB Correct answer: answer = 1
43 Correct 5 ms 876 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 364 KB Correct answer: answer = 4
46 Correct 1 ms 364 KB Correct answer: answer = 9
47 Correct 1 ms 364 KB Correct answer: answer = 9
48 Correct 1 ms 364 KB Correct answer: answer = 21
49 Correct 1 ms 364 KB Correct answer: answer = 71
50 Correct 1 ms 364 KB Correct answer: answer = 77
51 Correct 1 ms 364 KB Correct answer: answer = 400
52 Correct 2 ms 364 KB Correct answer: answer = 996004
53 Correct 2 ms 364 KB Correct answer: answer = 997310
54 Correct 1 ms 364 KB Correct answer: answer = 990781
55 Correct 1 ms 364 KB Correct answer: answer = 996545
56 Correct 2 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 1 ms 364 KB Correct answer: answer = 63501
59 Correct 2 ms 492 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 3 ms 748 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 11 ms 2284 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 2 ms 364 KB Correct answer: answer = 250000
67 Correct 1 ms 364 KB Correct answer: answer = 250000
68 Correct 1 ms 364 KB Correct answer: answer = 1000000
69 Correct 1 ms 364 KB Correct answer: answer = 994009
70 Correct 2 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 492 KB Correct answer: answer = 25454
72 Correct 3 ms 748 KB Correct answer: answer = 1504
73 Correct 1 ms 364 KB Correct answer: answer = 37486
74 Correct 2 ms 492 KB Correct answer: answer = 4284
75 Correct 3 ms 492 KB Correct answer: answer = 158008
76 Correct 2 ms 492 KB Correct answer: answer = 51860
77 Correct 1 ms 364 KB Correct answer: answer = 12985
78 Correct 3 ms 508 KB Correct answer: answer = 997864126212
79 Correct 3 ms 492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 748 KB Correct answer: answer = 995265560477
81 Correct 3 ms 620 KB Correct answer: answer = 10125000
82 Correct 4 ms 876 KB Correct answer: answer = 2291668
83 Correct 12 ms 2028 KB Correct answer: answer = 42388
84 Correct 40 ms 7020 KB Correct answer: answer = 10318
85 Correct 183 ms 22508 KB Correct answer: answer = 3416
86 Correct 3 ms 748 KB Correct answer: answer = 331708193881
87 Correct 62 ms 7916 KB Correct answer: answer = 2861193756
88 Correct 416 ms 42496 KB Correct answer: answer = 114646930
89 Correct 14 ms 2412 KB Correct answer: answer = 9280921
90 Correct 61 ms 9964 KB Correct answer: answer = 999984053400
91 Correct 235 ms 31852 KB Correct answer: answer = 750935949134
92 Correct 2 ms 492 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 492 KB Correct answer: answer = 998762383161
94 Correct 13 ms 1772 KB Correct answer: answer = 23017412908
95 Correct 5 ms 1004 KB Correct answer: answer = 728143410622
96 Correct 2 ms 492 KB Correct answer: answer = 2
97 Correct 5 ms 896 KB Correct answer: answer = 1824916
98 Correct 116 ms 16492 KB Correct answer: answer = 10680029
99 Correct 61 ms 8556 KB Correct answer: answer = 18351700
100 Correct 3 ms 620 KB Correct answer: answer = 16040026
101 Correct 2 ms 492 KB Correct answer: answer = 253968628325
102 Correct 104 ms 16108 KB Correct answer: answer = 10267
103 Correct 501 ms 55660 KB Correct answer: answer = 2582408
104 Correct 3 ms 492 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 5 ms 748 KB Correct answer: answer = 3327720949
107 Correct 19 ms 4076 KB Correct answer: answer = 86064128360
108 Correct 84 ms 17644 KB Correct answer: answer = 12698259150
109 Correct 567 ms 62956 KB Correct answer: answer = 1185259288
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 1 ms 364 KB Correct answer: answer = 4
4 Correct 1 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 2 ms 364 KB Correct answer: answer = 210
7 Correct 1 ms 364 KB Correct answer: answer = 88
8 Correct 1 ms 364 KB Correct answer: answer = 7696
9 Correct 1 ms 364 KB Correct answer: answer = 1
10 Correct 1 ms 364 KB Correct answer: answer = 2374
11 Correct 1 ms 364 KB Correct answer: answer = 9502
12 Correct 1 ms 364 KB Correct answer: answer = 49
13 Correct 1 ms 364 KB Correct answer: answer = 151
14 Correct 2 ms 364 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 364 KB Correct answer: answer = 7550
17 Correct 1 ms 364 KB Correct answer: answer = 10000
18 Correct 1 ms 384 KB Correct answer: answer = 10000
19 Correct 1 ms 364 KB Correct answer: answer = 624
20 Correct 1 ms 364 KB Correct answer: answer = 10000
21 Correct 1 ms 364 KB Correct answer: answer = 1
22 Correct 1 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 364 KB Correct answer: answer = 1
24 Correct 1 ms 364 KB Correct answer: answer = 5
25 Correct 1 ms 364 KB Correct answer: answer = 41
26 Correct 1 ms 364 KB Correct answer: answer = 71923
27 Correct 2 ms 364 KB Correct answer: answer = 77137
28 Correct 6 ms 1132 KB Correct answer: answer = 764
29 Correct 1 ms 364 KB Correct answer: answer = 250000
30 Correct 12 ms 2284 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 2 ms 364 KB Correct answer: answer = 130050
33 Correct 2 ms 492 KB Correct answer: answer = 5110
34 Correct 1 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 492 KB Correct answer: answer = 796
36 Correct 2 ms 492 KB Correct answer: answer = 7580
37 Correct 5 ms 876 KB Correct answer: answer = 1904
38 Correct 1 ms 364 KB Correct answer: answer = 996004
39 Correct 2 ms 364 KB Correct answer: answer = 38817
40 Correct 4 ms 620 KB Correct answer: answer = 4096
41 Correct 2 ms 364 KB Correct answer: answer = 1
42 Correct 1 ms 364 KB Correct answer: answer = 1
43 Correct 5 ms 876 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 364 KB Correct answer: answer = 4
46 Correct 1 ms 364 KB Correct answer: answer = 9
47 Correct 1 ms 364 KB Correct answer: answer = 9
48 Correct 1 ms 364 KB Correct answer: answer = 21
49 Correct 1 ms 364 KB Correct answer: answer = 71
50 Correct 1 ms 364 KB Correct answer: answer = 77
51 Correct 1 ms 364 KB Correct answer: answer = 400
52 Correct 2 ms 364 KB Correct answer: answer = 996004
53 Correct 2 ms 364 KB Correct answer: answer = 997310
54 Correct 1 ms 364 KB Correct answer: answer = 990781
55 Correct 1 ms 364 KB Correct answer: answer = 996545
56 Correct 2 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 1 ms 364 KB Correct answer: answer = 63501
59 Correct 2 ms 492 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 3 ms 748 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 11 ms 2284 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 2 ms 364 KB Correct answer: answer = 250000
67 Correct 1 ms 364 KB Correct answer: answer = 250000
68 Correct 1 ms 364 KB Correct answer: answer = 1000000
69 Correct 1 ms 364 KB Correct answer: answer = 994009
70 Correct 2 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 492 KB Correct answer: answer = 25454
72 Correct 3 ms 748 KB Correct answer: answer = 1504
73 Correct 1 ms 364 KB Correct answer: answer = 37486
74 Correct 2 ms 492 KB Correct answer: answer = 4284
75 Correct 3 ms 492 KB Correct answer: answer = 158008
76 Correct 2 ms 492 KB Correct answer: answer = 51860
77 Correct 1 ms 364 KB Correct answer: answer = 12985
78 Correct 3 ms 508 KB Correct answer: answer = 997864126212
79 Correct 3 ms 492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 748 KB Correct answer: answer = 995265560477
81 Correct 3 ms 620 KB Correct answer: answer = 10125000
82 Correct 4 ms 876 KB Correct answer: answer = 2291668
83 Correct 12 ms 2028 KB Correct answer: answer = 42388
84 Correct 40 ms 7020 KB Correct answer: answer = 10318
85 Correct 183 ms 22508 KB Correct answer: answer = 3416
86 Correct 3 ms 748 KB Correct answer: answer = 331708193881
87 Correct 62 ms 7916 KB Correct answer: answer = 2861193756
88 Correct 416 ms 42496 KB Correct answer: answer = 114646930
89 Correct 14 ms 2412 KB Correct answer: answer = 9280921
90 Correct 61 ms 9964 KB Correct answer: answer = 999984053400
91 Correct 235 ms 31852 KB Correct answer: answer = 750935949134
92 Correct 2 ms 492 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 492 KB Correct answer: answer = 998762383161
94 Correct 13 ms 1772 KB Correct answer: answer = 23017412908
95 Correct 5 ms 1004 KB Correct answer: answer = 728143410622
96 Correct 2 ms 492 KB Correct answer: answer = 2
97 Correct 5 ms 896 KB Correct answer: answer = 1824916
98 Correct 116 ms 16492 KB Correct answer: answer = 10680029
99 Correct 61 ms 8556 KB Correct answer: answer = 18351700
100 Correct 3 ms 620 KB Correct answer: answer = 16040026
101 Correct 2 ms 492 KB Correct answer: answer = 253968628325
102 Correct 104 ms 16108 KB Correct answer: answer = 10267
103 Correct 501 ms 55660 KB Correct answer: answer = 2582408
104 Correct 3 ms 492 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 5 ms 748 KB Correct answer: answer = 3327720949
107 Correct 19 ms 4076 KB Correct answer: answer = 86064128360
108 Correct 84 ms 17644 KB Correct answer: answer = 12698259150
109 Correct 567 ms 62956 KB Correct answer: answer = 1185259288
110 Correct 19 ms 1768 KB Correct answer: answer = 999889968863
111 Correct 20 ms 1784 KB Correct answer: answer = 999861384931
112 Correct 20 ms 1768 KB Correct answer: answer = 999811809929
113 Correct 20 ms 1768 KB Correct answer: answer = 999869756441
114 Correct 28 ms 4576 KB Correct answer: answer = 1700000000
115 Correct 74 ms 11616 KB Correct answer: answer = 131666670
116 Correct 9 ms 2024 KB Correct answer: answer = 89478486
117 Correct 55 ms 8424 KB Correct answer: answer = 4971040
118 Correct 101 ms 14440 KB Correct answer: answer = 2711494
119 Correct 291 ms 43104 KB Correct answer: answer = 25252530
120 Correct 126 ms 19552 KB Correct answer: answer = 62500000
121 Correct 33 ms 4968 KB Correct answer: answer = 333175097780
122 Correct 128 ms 14824 KB Correct answer: answer = 33121180179
123 Correct 368 ms 41576 KB Correct answer: answer = 9802314015
124 Correct 226 ms 34400 KB Correct answer: answer = 32567551
125 Correct 288 ms 43104 KB Correct answer: answer = 997525000000
126 Correct 333 ms 38916 KB Correct answer: answer = 752723538884
127 Correct 16 ms 1768 KB Correct answer: answer = 1000000000000
128 Correct 20 ms 1768 KB Correct answer: answer = 999978000121
129 Correct 21 ms 1768 KB Correct answer: answer = 745986144735
130 Correct 14 ms 1768 KB Correct answer: answer = 2
131 Correct 50 ms 7776 KB Correct answer: answer = 277966670
132 Correct 28 ms 4832 KB Correct answer: answer = 2500900082
133 Correct 20 ms 1892 KB Correct answer: answer = 301248349636
134 Correct 186 ms 21540 KB Correct answer: answer = 14118891
135 Correct 21 ms 1768 KB Correct answer: answer = 14384977265
136 Correct 21 ms 1768 KB Correct answer: answer = 3681368330
137 Correct 23 ms 2020 KB Correct answer: answer = 2720316816
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 1 ms 364 KB Correct answer: answer = 4
4 Correct 1 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 2 ms 364 KB Correct answer: answer = 210
7 Correct 1 ms 364 KB Correct answer: answer = 88
8 Correct 1 ms 364 KB Correct answer: answer = 7696
9 Correct 1 ms 364 KB Correct answer: answer = 1
10 Correct 1 ms 364 KB Correct answer: answer = 2374
11 Correct 1 ms 364 KB Correct answer: answer = 9502
12 Correct 1 ms 364 KB Correct answer: answer = 49
13 Correct 1 ms 364 KB Correct answer: answer = 151
14 Correct 2 ms 364 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 364 KB Correct answer: answer = 7550
17 Correct 1 ms 364 KB Correct answer: answer = 10000
18 Correct 1 ms 384 KB Correct answer: answer = 10000
19 Correct 1 ms 364 KB Correct answer: answer = 624
20 Correct 1 ms 364 KB Correct answer: answer = 10000
21 Correct 1 ms 364 KB Correct answer: answer = 1
22 Correct 1 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 364 KB Correct answer: answer = 1
24 Correct 1 ms 364 KB Correct answer: answer = 5
25 Correct 1 ms 364 KB Correct answer: answer = 41
26 Correct 1 ms 364 KB Correct answer: answer = 71923
27 Correct 2 ms 364 KB Correct answer: answer = 77137
28 Correct 6 ms 1132 KB Correct answer: answer = 764
29 Correct 1 ms 364 KB Correct answer: answer = 250000
30 Correct 12 ms 2284 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 2 ms 364 KB Correct answer: answer = 130050
33 Correct 2 ms 492 KB Correct answer: answer = 5110
34 Correct 1 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 492 KB Correct answer: answer = 796
36 Correct 2 ms 492 KB Correct answer: answer = 7580
37 Correct 5 ms 876 KB Correct answer: answer = 1904
38 Correct 1 ms 364 KB Correct answer: answer = 996004
39 Correct 2 ms 364 KB Correct answer: answer = 38817
40 Correct 4 ms 620 KB Correct answer: answer = 4096
41 Correct 2 ms 364 KB Correct answer: answer = 1
42 Correct 1 ms 364 KB Correct answer: answer = 1
43 Correct 5 ms 876 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 364 KB Correct answer: answer = 4
46 Correct 1 ms 364 KB Correct answer: answer = 9
47 Correct 1 ms 364 KB Correct answer: answer = 9
48 Correct 1 ms 364 KB Correct answer: answer = 21
49 Correct 1 ms 364 KB Correct answer: answer = 71
50 Correct 1 ms 364 KB Correct answer: answer = 77
51 Correct 1 ms 364 KB Correct answer: answer = 400
52 Correct 2 ms 364 KB Correct answer: answer = 996004
53 Correct 2 ms 364 KB Correct answer: answer = 997310
54 Correct 1 ms 364 KB Correct answer: answer = 990781
55 Correct 1 ms 364 KB Correct answer: answer = 996545
56 Correct 2 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 1 ms 364 KB Correct answer: answer = 63501
59 Correct 2 ms 492 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 3 ms 748 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 11 ms 2284 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 2 ms 364 KB Correct answer: answer = 250000
67 Correct 1 ms 364 KB Correct answer: answer = 250000
68 Correct 1 ms 364 KB Correct answer: answer = 1000000
69 Correct 1 ms 364 KB Correct answer: answer = 994009
70 Correct 2 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 492 KB Correct answer: answer = 25454
72 Correct 3 ms 748 KB Correct answer: answer = 1504
73 Correct 1 ms 364 KB Correct answer: answer = 37486
74 Correct 2 ms 492 KB Correct answer: answer = 4284
75 Correct 3 ms 492 KB Correct answer: answer = 158008
76 Correct 2 ms 492 KB Correct answer: answer = 51860
77 Correct 1 ms 364 KB Correct answer: answer = 12985
78 Correct 3 ms 508 KB Correct answer: answer = 997864126212
79 Correct 3 ms 492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 748 KB Correct answer: answer = 995265560477
81 Correct 3 ms 620 KB Correct answer: answer = 10125000
82 Correct 4 ms 876 KB Correct answer: answer = 2291668
83 Correct 12 ms 2028 KB Correct answer: answer = 42388
84 Correct 40 ms 7020 KB Correct answer: answer = 10318
85 Correct 183 ms 22508 KB Correct answer: answer = 3416
86 Correct 3 ms 748 KB Correct answer: answer = 331708193881
87 Correct 62 ms 7916 KB Correct answer: answer = 2861193756
88 Correct 416 ms 42496 KB Correct answer: answer = 114646930
89 Correct 14 ms 2412 KB Correct answer: answer = 9280921
90 Correct 61 ms 9964 KB Correct answer: answer = 999984053400
91 Correct 235 ms 31852 KB Correct answer: answer = 750935949134
92 Correct 2 ms 492 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 492 KB Correct answer: answer = 998762383161
94 Correct 13 ms 1772 KB Correct answer: answer = 23017412908
95 Correct 5 ms 1004 KB Correct answer: answer = 728143410622
96 Correct 2 ms 492 KB Correct answer: answer = 2
97 Correct 5 ms 896 KB Correct answer: answer = 1824916
98 Correct 116 ms 16492 KB Correct answer: answer = 10680029
99 Correct 61 ms 8556 KB Correct answer: answer = 18351700
100 Correct 3 ms 620 KB Correct answer: answer = 16040026
101 Correct 2 ms 492 KB Correct answer: answer = 253968628325
102 Correct 104 ms 16108 KB Correct answer: answer = 10267
103 Correct 501 ms 55660 KB Correct answer: answer = 2582408
104 Correct 3 ms 492 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 5 ms 748 KB Correct answer: answer = 3327720949
107 Correct 19 ms 4076 KB Correct answer: answer = 86064128360
108 Correct 84 ms 17644 KB Correct answer: answer = 12698259150
109 Correct 567 ms 62956 KB Correct answer: answer = 1185259288
110 Correct 19 ms 1768 KB Correct answer: answer = 999889968863
111 Correct 20 ms 1784 KB Correct answer: answer = 999861384931
112 Correct 20 ms 1768 KB Correct answer: answer = 999811809929
113 Correct 20 ms 1768 KB Correct answer: answer = 999869756441
114 Correct 28 ms 4576 KB Correct answer: answer = 1700000000
115 Correct 74 ms 11616 KB Correct answer: answer = 131666670
116 Correct 9 ms 2024 KB Correct answer: answer = 89478486
117 Correct 55 ms 8424 KB Correct answer: answer = 4971040
118 Correct 101 ms 14440 KB Correct answer: answer = 2711494
119 Correct 291 ms 43104 KB Correct answer: answer = 25252530
120 Correct 126 ms 19552 KB Correct answer: answer = 62500000
121 Correct 33 ms 4968 KB Correct answer: answer = 333175097780
122 Correct 128 ms 14824 KB Correct answer: answer = 33121180179
123 Correct 368 ms 41576 KB Correct answer: answer = 9802314015
124 Correct 226 ms 34400 KB Correct answer: answer = 32567551
125 Correct 288 ms 43104 KB Correct answer: answer = 997525000000
126 Correct 333 ms 38916 KB Correct answer: answer = 752723538884
127 Correct 16 ms 1768 KB Correct answer: answer = 1000000000000
128 Correct 20 ms 1768 KB Correct answer: answer = 999978000121
129 Correct 21 ms 1768 KB Correct answer: answer = 745986144735
130 Correct 14 ms 1768 KB Correct answer: answer = 2
131 Correct 50 ms 7776 KB Correct answer: answer = 277966670
132 Correct 28 ms 4832 KB Correct answer: answer = 2500900082
133 Correct 20 ms 1892 KB Correct answer: answer = 301248349636
134 Correct 186 ms 21540 KB Correct answer: answer = 14118891
135 Correct 21 ms 1768 KB Correct answer: answer = 14384977265
136 Correct 21 ms 1768 KB Correct answer: answer = 3681368330
137 Correct 23 ms 2020 KB Correct answer: answer = 2720316816
138 Correct 40 ms 3044 KB Correct answer: answer = 999976000144
139 Correct 46 ms 3068 KB Correct answer: answer = 999856102410
140 Correct 39 ms 3044 KB Correct answer: answer = 999958401531
141 Correct 41 ms 3296 KB Correct answer: answer = 999769649944
142 Correct 64 ms 8928 KB Correct answer: answer = 999874525918
143 Correct 55 ms 8916 KB Correct answer: answer = 6050000000
144 Correct 99 ms 15188 KB Correct answer: answer = 1112500000
145 Correct 29 ms 5476 KB Correct answer: answer = 4294967296
146 Correct 202 ms 30820 KB Correct answer: answer = 87652406
147 Execution timed out 2089 ms 354948 KB Time limit exceeded
148 Halted 0 ms 0 KB -