Submission #372784

# Submission time Handle Problem Language Result Execution time Memory
372784 2021-03-01T17:01:23 Z ogibogi2004 Aliens (IOI16_aliens) C++14
60 / 100
350 ms 9540 KB
#include "aliens.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF=1e14;
const ll MAXN=1e5+6;
struct line
{
	ll a,b;
	ll c;
	ll eval(ll x)
	{
		return x*a+b;
	}
	ll operator+(const line& other)
	{
		if(a==other.a)assert(false);
		return (other.b-b)/(a-other.a);
	}
};
struct CHT
{
	deque<line>dq;
	bool bad(line ezdp)
	{
		if(dq.size()==1)return 0;
		line l1=dq.end()[-2];
		line l2=dq.end()[-1];
		return l1+ezdp<l1+l2;
	}
	void push(line ezdp)
	{
		while(dq.size()>1&&bad(ezdp))
		{
			dq.pop_back();
		}
		dq.push_back(ezdp);
	}
	pair<ll,ll> query(ll x)
	{
		while(dq.size()>1&&(dq[0].eval(x)>dq[1].eval(x)||(dq[0].eval(x)==dq[1].eval(x)&&dq[0].c>dq[1].c)))
		{
			dq.pop_front();
		}
		//cout<<"&& "<<dq[0].a<<" "<<dq[0].b<<" "<<dq[0].c<<endl;
		return {dq[0].eval(x),dq[0].c};
	}
	void init()
	{
		dq.clear();
	}
}t;
struct poll 
{
	ll x,y;
	bool operator<(poll  const& other)const
	{
		return make_pair(x,-y)<make_pair(other.x,-other.y);
	}
};
vector<poll >v;
vector<poll >aux;
pair<ll,ll> dp[MAXN];
pair<ll,ll> calc(vector<poll >v,ll pen)
{
	t.init();
	for(ll  i=0;i<MAXN;i++)
	{
		dp[i]={INF,INF};
	}
	/*
	 const - x[i]*x[i]+pen+1+2*x[i]
	 a - -2*y[j+1]
	 b - max(x[j]-y[j+1]+1,0)*max(x[j]-y[j+1]+1,0)+dp[j]+y[j+1]*y[j+1]-2*y[j+1] 
	 c - dp[j].second
	*/
	dp[0]={(v[0].x-v[0].y+1)*(v[0].x-v[0].y+1)+pen,1};
	//cout<<"areve "<<max(v[0].x-v[1].y+1,0ll)*max(v[0].x-v[1].y+1,0ll)<<endl;
	//cout<<max(v[0].x-v[1].y+1,0ll)*max(v[0].x-v[1].y+1,0ll)+dp[0].first+v[1].y*v[1].y-2*v[1].y<<" "<<-max(v[0].x-v[1].y+1,0ll)*max(v[0].x-v[1].y+1,0ll)+dp[0].first+v[1].y*v[1].y-2*v[1].y<<endl;
	t.push({-2*v[1].y,-max(v[0].x-v[1].y+1,0ll)*max(v[0].x-v[1].y+1,0ll)+dp[0].first+v[1].y*v[1].y-2*v[1].y,1});
	//cout<<"dp\n";
	for(ll i=1;i<v.size();i++)
	{
		//cout<<"CHT is:\n";
		/*for(auto xd:t.dq)
		{
			cout<<xd.a<<" "<<xd.b<<" "<<xd.c<<endl;
		}
		cout<<"--\n";*/
		pair<ll,ll> gg=t.query(v[i].x);
		dp[i]={v[i].x*v[i].x+pen+1+2*v[i].x+gg.first,gg.second+1};
		dp[i]=min(dp[i],{(v[i].x-v[0].y+1)*(v[i].x-v[0].y+1)+pen,1});
		if(i+1<v.size())t.push({-2*v[i+1].y,-max(v[i].x-v[i+1].y+1,0ll)*max(v[i].x-v[i+1].y+1,0ll)+dp[i].first+v[i+1].y*v[i+1].y-2*v[i+1].y,dp[i].second});
		//cout<<dp[i].first<<" "<<dp[i].second<<endl;
	}
	//cout<<"----\n";
	return dp[v.size()-1];
}
long long take_photos(int  n, int  m, int  k, vector<int> r, vector<int> c) {
    for(ll i=0;i<r.size();i++)
    {
		if(r[i]<c[i])swap(r[i],c[i]);
		aux.push_back({r[i],c[i]});
	}
	sort(aux.begin(),aux.end());
	for(auto xd:aux)
	{
		while(v.size()>0&&v.back().y>=xd.y)
		{
			v.pop_back();
		}
		v.push_back(xd);
	}
	/*cout<<"v:\n";
	for(auto xd:v)
	{
		cout<<xd.x<<" "<<xd.y<<endl;
	}*/
	//cout<<"bs:\n";
	ll low=0,high=INF,mid,ans=-1;
	while(low<=high)
	{
		mid=(low+high)/2;
		ll t=calc(v,mid).second;
		//cout<<mid<<" "<<t<<endl;
		if(t<=k)
		{
			ans=mid;
			high=mid-1;
		}
		else
		{
			low=mid+1;
		}
	}
	//cout<<"------";
	pair<ll,ll> f=calc(v,ans);
	//cout<<f.first<<" "<<ans<<endl;
	return f.first-k*ans;
    return 0;
}

Compilation message

aliens.cpp: In function 'std::pair<long long int, long long int> calc(std::vector<poll>, long long int)':
aliens.cpp:82:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<poll>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |  for(ll i=1;i<v.size();i++)
      |             ~^~~~~~~~~
aliens.cpp:93:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<poll>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   93 |   if(i+1<v.size())t.push({-2*v[i+1].y,-max(v[i].x-v[i+1].y+1,0ll)*max(v[i].x-v[i+1].y+1,0ll)+dp[i].first+v[i+1].y*v[i+1].y-2*v[i+1].y,dp[i].second});
      |      ~~~^~~~~~~~~
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:100:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  100 |     for(ll i=0;i<r.size();i++)
      |                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1900 KB Correct answer: answer = 4
2 Correct 5 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 4
4 Correct 6 ms 1900 KB Correct answer: answer = 12
5 Correct 6 ms 1900 KB Correct answer: answer = 52
6 Correct 6 ms 1900 KB Correct answer: answer = 210
7 Correct 6 ms 1900 KB Correct answer: answer = 88
8 Correct 6 ms 1900 KB Correct answer: answer = 7696
9 Correct 6 ms 2028 KB Correct answer: answer = 1
10 Correct 6 ms 1900 KB Correct answer: answer = 2374
11 Correct 6 ms 1900 KB Correct answer: answer = 9502
12 Correct 7 ms 1900 KB Correct answer: answer = 49
13 Correct 6 ms 1900 KB Correct answer: answer = 151
14 Correct 6 ms 1900 KB Correct answer: answer = 7550
15 Correct 6 ms 1900 KB Correct answer: answer = 7220
16 Correct 6 ms 1900 KB Correct answer: answer = 7550
17 Correct 6 ms 1900 KB Correct answer: answer = 10000
18 Correct 6 ms 1900 KB Correct answer: answer = 10000
19 Correct 6 ms 1900 KB Correct answer: answer = 624
20 Correct 6 ms 1900 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1900 KB Correct answer: answer = 1
2 Correct 7 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 1
4 Correct 6 ms 1900 KB Correct answer: answer = 5
5 Correct 6 ms 1900 KB Correct answer: answer = 41
6 Correct 6 ms 1900 KB Correct answer: answer = 71923
7 Correct 6 ms 1900 KB Correct answer: answer = 77137
8 Correct 7 ms 1900 KB Correct answer: answer = 764
9 Correct 7 ms 1900 KB Correct answer: answer = 250000
10 Correct 7 ms 1900 KB Correct answer: answer = 500
11 Correct 6 ms 1900 KB Correct answer: answer = 32
12 Correct 7 ms 1900 KB Correct answer: answer = 130050
13 Correct 7 ms 1900 KB Correct answer: answer = 5110
14 Correct 6 ms 1900 KB Correct answer: answer = 2626
15 Correct 6 ms 1900 KB Correct answer: answer = 796
16 Correct 7 ms 1900 KB Correct answer: answer = 7580
17 Correct 7 ms 1900 KB Correct answer: answer = 1904
18 Correct 9 ms 1900 KB Correct answer: answer = 996004
19 Correct 7 ms 1900 KB Correct answer: answer = 38817
20 Correct 7 ms 1900 KB Correct answer: answer = 4096
21 Correct 6 ms 1900 KB Correct answer: answer = 1
22 Correct 6 ms 1900 KB Correct answer: answer = 1
23 Correct 7 ms 1900 KB Correct answer: answer = 2040
24 Correct 6 ms 1900 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1900 KB Correct answer: answer = 4
2 Correct 5 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 4
4 Correct 6 ms 1900 KB Correct answer: answer = 12
5 Correct 6 ms 1900 KB Correct answer: answer = 52
6 Correct 6 ms 1900 KB Correct answer: answer = 210
7 Correct 6 ms 1900 KB Correct answer: answer = 88
8 Correct 6 ms 1900 KB Correct answer: answer = 7696
9 Correct 6 ms 2028 KB Correct answer: answer = 1
10 Correct 6 ms 1900 KB Correct answer: answer = 2374
11 Correct 6 ms 1900 KB Correct answer: answer = 9502
12 Correct 7 ms 1900 KB Correct answer: answer = 49
13 Correct 6 ms 1900 KB Correct answer: answer = 151
14 Correct 6 ms 1900 KB Correct answer: answer = 7550
15 Correct 6 ms 1900 KB Correct answer: answer = 7220
16 Correct 6 ms 1900 KB Correct answer: answer = 7550
17 Correct 6 ms 1900 KB Correct answer: answer = 10000
18 Correct 6 ms 1900 KB Correct answer: answer = 10000
19 Correct 6 ms 1900 KB Correct answer: answer = 624
20 Correct 6 ms 1900 KB Correct answer: answer = 10000
21 Correct 7 ms 1900 KB Correct answer: answer = 1
22 Correct 7 ms 1900 KB Correct answer: answer = 4
23 Correct 6 ms 1900 KB Correct answer: answer = 1
24 Correct 6 ms 1900 KB Correct answer: answer = 5
25 Correct 6 ms 1900 KB Correct answer: answer = 41
26 Correct 6 ms 1900 KB Correct answer: answer = 71923
27 Correct 6 ms 1900 KB Correct answer: answer = 77137
28 Correct 7 ms 1900 KB Correct answer: answer = 764
29 Correct 7 ms 1900 KB Correct answer: answer = 250000
30 Correct 7 ms 1900 KB Correct answer: answer = 500
31 Correct 6 ms 1900 KB Correct answer: answer = 32
32 Correct 7 ms 1900 KB Correct answer: answer = 130050
33 Correct 7 ms 1900 KB Correct answer: answer = 5110
34 Correct 6 ms 1900 KB Correct answer: answer = 2626
35 Correct 6 ms 1900 KB Correct answer: answer = 796
36 Correct 7 ms 1900 KB Correct answer: answer = 7580
37 Correct 7 ms 1900 KB Correct answer: answer = 1904
38 Correct 9 ms 1900 KB Correct answer: answer = 996004
39 Correct 7 ms 1900 KB Correct answer: answer = 38817
40 Correct 7 ms 1900 KB Correct answer: answer = 4096
41 Correct 6 ms 1900 KB Correct answer: answer = 1
42 Correct 6 ms 1900 KB Correct answer: answer = 1
43 Correct 7 ms 1900 KB Correct answer: answer = 2040
44 Correct 6 ms 1900 KB Correct answer: answer = 2
45 Correct 5 ms 1900 KB Correct answer: answer = 4
46 Correct 6 ms 1900 KB Correct answer: answer = 9
47 Correct 6 ms 1900 KB Correct answer: answer = 9
48 Correct 6 ms 1900 KB Correct answer: answer = 21
49 Correct 6 ms 1900 KB Correct answer: answer = 71
50 Correct 6 ms 1900 KB Correct answer: answer = 77
51 Correct 6 ms 1900 KB Correct answer: answer = 400
52 Correct 6 ms 1900 KB Correct answer: answer = 996004
53 Correct 6 ms 1900 KB Correct answer: answer = 997310
54 Correct 6 ms 1900 KB Correct answer: answer = 990781
55 Correct 6 ms 1900 KB Correct answer: answer = 996545
56 Correct 6 ms 1900 KB Correct answer: answer = 484
57 Correct 6 ms 1900 KB Correct answer: answer = 484
58 Correct 7 ms 1900 KB Correct answer: answer = 63501
59 Correct 7 ms 1900 KB Correct answer: answer = 323501
60 Correct 8 ms 1900 KB Correct answer: answer = 752500
61 Correct 6 ms 1900 KB Correct answer: answer = 761480
62 Correct 7 ms 1900 KB Correct answer: answer = 758932
63 Correct 6 ms 1900 KB Correct answer: answer = 1000000
64 Correct 7 ms 1976 KB Correct answer: answer = 750500
65 Correct 6 ms 1900 KB Correct answer: answer = 1000000
66 Correct 6 ms 1900 KB Correct answer: answer = 250000
67 Correct 6 ms 1900 KB Correct answer: answer = 250000
68 Correct 6 ms 1900 KB Correct answer: answer = 1000000
69 Correct 6 ms 1900 KB Correct answer: answer = 994009
70 Correct 6 ms 1900 KB Correct answer: answer = 59315
71 Correct 7 ms 1900 KB Correct answer: answer = 25454
72 Correct 6 ms 1900 KB Correct answer: answer = 1504
73 Correct 6 ms 1900 KB Correct answer: answer = 37486
74 Correct 7 ms 1900 KB Correct answer: answer = 4284
75 Correct 7 ms 1900 KB Correct answer: answer = 158008
76 Correct 6 ms 1900 KB Correct answer: answer = 51860
77 Correct 6 ms 1900 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1900 KB Correct answer: answer = 4
2 Correct 5 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 4
4 Correct 6 ms 1900 KB Correct answer: answer = 12
5 Correct 6 ms 1900 KB Correct answer: answer = 52
6 Correct 6 ms 1900 KB Correct answer: answer = 210
7 Correct 6 ms 1900 KB Correct answer: answer = 88
8 Correct 6 ms 1900 KB Correct answer: answer = 7696
9 Correct 6 ms 2028 KB Correct answer: answer = 1
10 Correct 6 ms 1900 KB Correct answer: answer = 2374
11 Correct 6 ms 1900 KB Correct answer: answer = 9502
12 Correct 7 ms 1900 KB Correct answer: answer = 49
13 Correct 6 ms 1900 KB Correct answer: answer = 151
14 Correct 6 ms 1900 KB Correct answer: answer = 7550
15 Correct 6 ms 1900 KB Correct answer: answer = 7220
16 Correct 6 ms 1900 KB Correct answer: answer = 7550
17 Correct 6 ms 1900 KB Correct answer: answer = 10000
18 Correct 6 ms 1900 KB Correct answer: answer = 10000
19 Correct 6 ms 1900 KB Correct answer: answer = 624
20 Correct 6 ms 1900 KB Correct answer: answer = 10000
21 Correct 7 ms 1900 KB Correct answer: answer = 1
22 Correct 7 ms 1900 KB Correct answer: answer = 4
23 Correct 6 ms 1900 KB Correct answer: answer = 1
24 Correct 6 ms 1900 KB Correct answer: answer = 5
25 Correct 6 ms 1900 KB Correct answer: answer = 41
26 Correct 6 ms 1900 KB Correct answer: answer = 71923
27 Correct 6 ms 1900 KB Correct answer: answer = 77137
28 Correct 7 ms 1900 KB Correct answer: answer = 764
29 Correct 7 ms 1900 KB Correct answer: answer = 250000
30 Correct 7 ms 1900 KB Correct answer: answer = 500
31 Correct 6 ms 1900 KB Correct answer: answer = 32
32 Correct 7 ms 1900 KB Correct answer: answer = 130050
33 Correct 7 ms 1900 KB Correct answer: answer = 5110
34 Correct 6 ms 1900 KB Correct answer: answer = 2626
35 Correct 6 ms 1900 KB Correct answer: answer = 796
36 Correct 7 ms 1900 KB Correct answer: answer = 7580
37 Correct 7 ms 1900 KB Correct answer: answer = 1904
38 Correct 9 ms 1900 KB Correct answer: answer = 996004
39 Correct 7 ms 1900 KB Correct answer: answer = 38817
40 Correct 7 ms 1900 KB Correct answer: answer = 4096
41 Correct 6 ms 1900 KB Correct answer: answer = 1
42 Correct 6 ms 1900 KB Correct answer: answer = 1
43 Correct 7 ms 1900 KB Correct answer: answer = 2040
44 Correct 6 ms 1900 KB Correct answer: answer = 2
45 Correct 5 ms 1900 KB Correct answer: answer = 4
46 Correct 6 ms 1900 KB Correct answer: answer = 9
47 Correct 6 ms 1900 KB Correct answer: answer = 9
48 Correct 6 ms 1900 KB Correct answer: answer = 21
49 Correct 6 ms 1900 KB Correct answer: answer = 71
50 Correct 6 ms 1900 KB Correct answer: answer = 77
51 Correct 6 ms 1900 KB Correct answer: answer = 400
52 Correct 6 ms 1900 KB Correct answer: answer = 996004
53 Correct 6 ms 1900 KB Correct answer: answer = 997310
54 Correct 6 ms 1900 KB Correct answer: answer = 990781
55 Correct 6 ms 1900 KB Correct answer: answer = 996545
56 Correct 6 ms 1900 KB Correct answer: answer = 484
57 Correct 6 ms 1900 KB Correct answer: answer = 484
58 Correct 7 ms 1900 KB Correct answer: answer = 63501
59 Correct 7 ms 1900 KB Correct answer: answer = 323501
60 Correct 8 ms 1900 KB Correct answer: answer = 752500
61 Correct 6 ms 1900 KB Correct answer: answer = 761480
62 Correct 7 ms 1900 KB Correct answer: answer = 758932
63 Correct 6 ms 1900 KB Correct answer: answer = 1000000
64 Correct 7 ms 1976 KB Correct answer: answer = 750500
65 Correct 6 ms 1900 KB Correct answer: answer = 1000000
66 Correct 6 ms 1900 KB Correct answer: answer = 250000
67 Correct 6 ms 1900 KB Correct answer: answer = 250000
68 Correct 6 ms 1900 KB Correct answer: answer = 1000000
69 Correct 6 ms 1900 KB Correct answer: answer = 994009
70 Correct 6 ms 1900 KB Correct answer: answer = 59315
71 Correct 7 ms 1900 KB Correct answer: answer = 25454
72 Correct 6 ms 1900 KB Correct answer: answer = 1504
73 Correct 6 ms 1900 KB Correct answer: answer = 37486
74 Correct 7 ms 1900 KB Correct answer: answer = 4284
75 Correct 7 ms 1900 KB Correct answer: answer = 158008
76 Correct 6 ms 1900 KB Correct answer: answer = 51860
77 Correct 6 ms 1900 KB Correct answer: answer = 12985
78 Correct 7 ms 2028 KB Correct answer: answer = 997864126212
79 Correct 7 ms 2028 KB Correct answer: answer = 998608411647
80 Correct 7 ms 2028 KB Correct answer: answer = 995265560477
81 Correct 16 ms 2156 KB Correct answer: answer = 10125000
82 Correct 16 ms 2156 KB Correct answer: answer = 2291668
83 Correct 10 ms 2028 KB Correct answer: answer = 42388
84 Correct 10 ms 2048 KB Correct answer: answer = 10318
85 Correct 11 ms 2028 KB Correct answer: answer = 3416
86 Correct 20 ms 2156 KB Correct answer: answer = 331708193881
87 Correct 19 ms 2156 KB Correct answer: answer = 2861193756
88 Correct 19 ms 2156 KB Correct answer: answer = 114646930
89 Correct 15 ms 2156 KB Correct answer: answer = 9280921
90 Correct 15 ms 2156 KB Correct answer: answer = 999984053400
91 Correct 20 ms 2156 KB Correct answer: answer = 750935949134
92 Correct 7 ms 2028 KB Correct answer: answer = 1000000000000
93 Correct 7 ms 2028 KB Correct answer: answer = 998762383161
94 Correct 19 ms 2176 KB Correct answer: answer = 23017412908
95 Correct 7 ms 2028 KB Correct answer: answer = 728143410622
96 Correct 7 ms 2028 KB Correct answer: answer = 2
97 Correct 16 ms 2156 KB Correct answer: answer = 1824916
98 Correct 17 ms 2156 KB Correct answer: answer = 10680029
99 Correct 17 ms 2288 KB Correct answer: answer = 18351700
100 Correct 16 ms 2156 KB Correct answer: answer = 16040026
101 Correct 8 ms 2028 KB Correct answer: answer = 253968628325
102 Correct 11 ms 2028 KB Correct answer: answer = 10267
103 Correct 17 ms 2156 KB Correct answer: answer = 2582408
104 Correct 7 ms 2028 KB Correct answer: answer = 78024964781
105 Correct 8 ms 2028 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2028 KB Correct answer: answer = 3327720949
107 Correct 8 ms 2028 KB Correct answer: answer = 86064128360
108 Correct 9 ms 2028 KB Correct answer: answer = 12698259150
109 Correct 17 ms 2304 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1900 KB Correct answer: answer = 4
2 Correct 5 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 4
4 Correct 6 ms 1900 KB Correct answer: answer = 12
5 Correct 6 ms 1900 KB Correct answer: answer = 52
6 Correct 6 ms 1900 KB Correct answer: answer = 210
7 Correct 6 ms 1900 KB Correct answer: answer = 88
8 Correct 6 ms 1900 KB Correct answer: answer = 7696
9 Correct 6 ms 2028 KB Correct answer: answer = 1
10 Correct 6 ms 1900 KB Correct answer: answer = 2374
11 Correct 6 ms 1900 KB Correct answer: answer = 9502
12 Correct 7 ms 1900 KB Correct answer: answer = 49
13 Correct 6 ms 1900 KB Correct answer: answer = 151
14 Correct 6 ms 1900 KB Correct answer: answer = 7550
15 Correct 6 ms 1900 KB Correct answer: answer = 7220
16 Correct 6 ms 1900 KB Correct answer: answer = 7550
17 Correct 6 ms 1900 KB Correct answer: answer = 10000
18 Correct 6 ms 1900 KB Correct answer: answer = 10000
19 Correct 6 ms 1900 KB Correct answer: answer = 624
20 Correct 6 ms 1900 KB Correct answer: answer = 10000
21 Correct 7 ms 1900 KB Correct answer: answer = 1
22 Correct 7 ms 1900 KB Correct answer: answer = 4
23 Correct 6 ms 1900 KB Correct answer: answer = 1
24 Correct 6 ms 1900 KB Correct answer: answer = 5
25 Correct 6 ms 1900 KB Correct answer: answer = 41
26 Correct 6 ms 1900 KB Correct answer: answer = 71923
27 Correct 6 ms 1900 KB Correct answer: answer = 77137
28 Correct 7 ms 1900 KB Correct answer: answer = 764
29 Correct 7 ms 1900 KB Correct answer: answer = 250000
30 Correct 7 ms 1900 KB Correct answer: answer = 500
31 Correct 6 ms 1900 KB Correct answer: answer = 32
32 Correct 7 ms 1900 KB Correct answer: answer = 130050
33 Correct 7 ms 1900 KB Correct answer: answer = 5110
34 Correct 6 ms 1900 KB Correct answer: answer = 2626
35 Correct 6 ms 1900 KB Correct answer: answer = 796
36 Correct 7 ms 1900 KB Correct answer: answer = 7580
37 Correct 7 ms 1900 KB Correct answer: answer = 1904
38 Correct 9 ms 1900 KB Correct answer: answer = 996004
39 Correct 7 ms 1900 KB Correct answer: answer = 38817
40 Correct 7 ms 1900 KB Correct answer: answer = 4096
41 Correct 6 ms 1900 KB Correct answer: answer = 1
42 Correct 6 ms 1900 KB Correct answer: answer = 1
43 Correct 7 ms 1900 KB Correct answer: answer = 2040
44 Correct 6 ms 1900 KB Correct answer: answer = 2
45 Correct 5 ms 1900 KB Correct answer: answer = 4
46 Correct 6 ms 1900 KB Correct answer: answer = 9
47 Correct 6 ms 1900 KB Correct answer: answer = 9
48 Correct 6 ms 1900 KB Correct answer: answer = 21
49 Correct 6 ms 1900 KB Correct answer: answer = 71
50 Correct 6 ms 1900 KB Correct answer: answer = 77
51 Correct 6 ms 1900 KB Correct answer: answer = 400
52 Correct 6 ms 1900 KB Correct answer: answer = 996004
53 Correct 6 ms 1900 KB Correct answer: answer = 997310
54 Correct 6 ms 1900 KB Correct answer: answer = 990781
55 Correct 6 ms 1900 KB Correct answer: answer = 996545
56 Correct 6 ms 1900 KB Correct answer: answer = 484
57 Correct 6 ms 1900 KB Correct answer: answer = 484
58 Correct 7 ms 1900 KB Correct answer: answer = 63501
59 Correct 7 ms 1900 KB Correct answer: answer = 323501
60 Correct 8 ms 1900 KB Correct answer: answer = 752500
61 Correct 6 ms 1900 KB Correct answer: answer = 761480
62 Correct 7 ms 1900 KB Correct answer: answer = 758932
63 Correct 6 ms 1900 KB Correct answer: answer = 1000000
64 Correct 7 ms 1976 KB Correct answer: answer = 750500
65 Correct 6 ms 1900 KB Correct answer: answer = 1000000
66 Correct 6 ms 1900 KB Correct answer: answer = 250000
67 Correct 6 ms 1900 KB Correct answer: answer = 250000
68 Correct 6 ms 1900 KB Correct answer: answer = 1000000
69 Correct 6 ms 1900 KB Correct answer: answer = 994009
70 Correct 6 ms 1900 KB Correct answer: answer = 59315
71 Correct 7 ms 1900 KB Correct answer: answer = 25454
72 Correct 6 ms 1900 KB Correct answer: answer = 1504
73 Correct 6 ms 1900 KB Correct answer: answer = 37486
74 Correct 7 ms 1900 KB Correct answer: answer = 4284
75 Correct 7 ms 1900 KB Correct answer: answer = 158008
76 Correct 6 ms 1900 KB Correct answer: answer = 51860
77 Correct 6 ms 1900 KB Correct answer: answer = 12985
78 Correct 7 ms 2028 KB Correct answer: answer = 997864126212
79 Correct 7 ms 2028 KB Correct answer: answer = 998608411647
80 Correct 7 ms 2028 KB Correct answer: answer = 995265560477
81 Correct 16 ms 2156 KB Correct answer: answer = 10125000
82 Correct 16 ms 2156 KB Correct answer: answer = 2291668
83 Correct 10 ms 2028 KB Correct answer: answer = 42388
84 Correct 10 ms 2048 KB Correct answer: answer = 10318
85 Correct 11 ms 2028 KB Correct answer: answer = 3416
86 Correct 20 ms 2156 KB Correct answer: answer = 331708193881
87 Correct 19 ms 2156 KB Correct answer: answer = 2861193756
88 Correct 19 ms 2156 KB Correct answer: answer = 114646930
89 Correct 15 ms 2156 KB Correct answer: answer = 9280921
90 Correct 15 ms 2156 KB Correct answer: answer = 999984053400
91 Correct 20 ms 2156 KB Correct answer: answer = 750935949134
92 Correct 7 ms 2028 KB Correct answer: answer = 1000000000000
93 Correct 7 ms 2028 KB Correct answer: answer = 998762383161
94 Correct 19 ms 2176 KB Correct answer: answer = 23017412908
95 Correct 7 ms 2028 KB Correct answer: answer = 728143410622
96 Correct 7 ms 2028 KB Correct answer: answer = 2
97 Correct 16 ms 2156 KB Correct answer: answer = 1824916
98 Correct 17 ms 2156 KB Correct answer: answer = 10680029
99 Correct 17 ms 2288 KB Correct answer: answer = 18351700
100 Correct 16 ms 2156 KB Correct answer: answer = 16040026
101 Correct 8 ms 2028 KB Correct answer: answer = 253968628325
102 Correct 11 ms 2028 KB Correct answer: answer = 10267
103 Correct 17 ms 2156 KB Correct answer: answer = 2582408
104 Correct 7 ms 2028 KB Correct answer: answer = 78024964781
105 Correct 8 ms 2028 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2028 KB Correct answer: answer = 3327720949
107 Correct 8 ms 2028 KB Correct answer: answer = 86064128360
108 Correct 9 ms 2028 KB Correct answer: answer = 12698259150
109 Correct 17 ms 2304 KB Correct answer: answer = 1185259288
110 Correct 24 ms 3684 KB Correct answer: answer = 999889968863
111 Correct 24 ms 3552 KB Correct answer: answer = 999861384931
112 Correct 24 ms 3552 KB Correct answer: answer = 999811809929
113 Correct 24 ms 3552 KB Correct answer: answer = 999869756441
114 Correct 144 ms 5584 KB Correct answer: answer = 1700000000
115 Correct 143 ms 5584 KB Correct answer: answer = 131666670
116 Correct 57 ms 3180 KB Correct answer: answer = 89478486
117 Correct 49 ms 3304 KB Correct answer: answer = 4971040
118 Correct 44 ms 3180 KB Correct answer: answer = 2711494
119 Correct 131 ms 5604 KB Correct answer: answer = 25252530
120 Correct 140 ms 5788 KB Correct answer: answer = 62500000
121 Correct 183 ms 5092 KB Correct answer: answer = 333175097780
122 Correct 180 ms 5092 KB Correct answer: answer = 33121180179
123 Correct 179 ms 5092 KB Correct answer: answer = 9802314015
124 Correct 132 ms 5712 KB Correct answer: answer = 32567551
125 Correct 138 ms 5604 KB Correct answer: answer = 997525000000
126 Correct 170 ms 4964 KB Correct answer: answer = 752723538884
127 Correct 18 ms 3552 KB Correct answer: answer = 1000000000000
128 Correct 22 ms 3552 KB Correct answer: answer = 999978000121
129 Correct 27 ms 3680 KB Correct answer: answer = 745986144735
130 Correct 17 ms 3552 KB Correct answer: answer = 2
131 Correct 137 ms 5700 KB Correct answer: answer = 277966670
132 Correct 136 ms 5712 KB Correct answer: answer = 2500900082
133 Correct 41 ms 3808 KB Correct answer: answer = 301248349636
134 Correct 90 ms 3556 KB Correct answer: answer = 14118891
135 Correct 25 ms 3552 KB Correct answer: answer = 14384977265
136 Correct 25 ms 3552 KB Correct answer: answer = 3681368330
137 Correct 26 ms 3552 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1900 KB Correct answer: answer = 4
2 Correct 5 ms 1900 KB Correct answer: answer = 4
3 Correct 6 ms 1900 KB Correct answer: answer = 4
4 Correct 6 ms 1900 KB Correct answer: answer = 12
5 Correct 6 ms 1900 KB Correct answer: answer = 52
6 Correct 6 ms 1900 KB Correct answer: answer = 210
7 Correct 6 ms 1900 KB Correct answer: answer = 88
8 Correct 6 ms 1900 KB Correct answer: answer = 7696
9 Correct 6 ms 2028 KB Correct answer: answer = 1
10 Correct 6 ms 1900 KB Correct answer: answer = 2374
11 Correct 6 ms 1900 KB Correct answer: answer = 9502
12 Correct 7 ms 1900 KB Correct answer: answer = 49
13 Correct 6 ms 1900 KB Correct answer: answer = 151
14 Correct 6 ms 1900 KB Correct answer: answer = 7550
15 Correct 6 ms 1900 KB Correct answer: answer = 7220
16 Correct 6 ms 1900 KB Correct answer: answer = 7550
17 Correct 6 ms 1900 KB Correct answer: answer = 10000
18 Correct 6 ms 1900 KB Correct answer: answer = 10000
19 Correct 6 ms 1900 KB Correct answer: answer = 624
20 Correct 6 ms 1900 KB Correct answer: answer = 10000
21 Correct 7 ms 1900 KB Correct answer: answer = 1
22 Correct 7 ms 1900 KB Correct answer: answer = 4
23 Correct 6 ms 1900 KB Correct answer: answer = 1
24 Correct 6 ms 1900 KB Correct answer: answer = 5
25 Correct 6 ms 1900 KB Correct answer: answer = 41
26 Correct 6 ms 1900 KB Correct answer: answer = 71923
27 Correct 6 ms 1900 KB Correct answer: answer = 77137
28 Correct 7 ms 1900 KB Correct answer: answer = 764
29 Correct 7 ms 1900 KB Correct answer: answer = 250000
30 Correct 7 ms 1900 KB Correct answer: answer = 500
31 Correct 6 ms 1900 KB Correct answer: answer = 32
32 Correct 7 ms 1900 KB Correct answer: answer = 130050
33 Correct 7 ms 1900 KB Correct answer: answer = 5110
34 Correct 6 ms 1900 KB Correct answer: answer = 2626
35 Correct 6 ms 1900 KB Correct answer: answer = 796
36 Correct 7 ms 1900 KB Correct answer: answer = 7580
37 Correct 7 ms 1900 KB Correct answer: answer = 1904
38 Correct 9 ms 1900 KB Correct answer: answer = 996004
39 Correct 7 ms 1900 KB Correct answer: answer = 38817
40 Correct 7 ms 1900 KB Correct answer: answer = 4096
41 Correct 6 ms 1900 KB Correct answer: answer = 1
42 Correct 6 ms 1900 KB Correct answer: answer = 1
43 Correct 7 ms 1900 KB Correct answer: answer = 2040
44 Correct 6 ms 1900 KB Correct answer: answer = 2
45 Correct 5 ms 1900 KB Correct answer: answer = 4
46 Correct 6 ms 1900 KB Correct answer: answer = 9
47 Correct 6 ms 1900 KB Correct answer: answer = 9
48 Correct 6 ms 1900 KB Correct answer: answer = 21
49 Correct 6 ms 1900 KB Correct answer: answer = 71
50 Correct 6 ms 1900 KB Correct answer: answer = 77
51 Correct 6 ms 1900 KB Correct answer: answer = 400
52 Correct 6 ms 1900 KB Correct answer: answer = 996004
53 Correct 6 ms 1900 KB Correct answer: answer = 997310
54 Correct 6 ms 1900 KB Correct answer: answer = 990781
55 Correct 6 ms 1900 KB Correct answer: answer = 996545
56 Correct 6 ms 1900 KB Correct answer: answer = 484
57 Correct 6 ms 1900 KB Correct answer: answer = 484
58 Correct 7 ms 1900 KB Correct answer: answer = 63501
59 Correct 7 ms 1900 KB Correct answer: answer = 323501
60 Correct 8 ms 1900 KB Correct answer: answer = 752500
61 Correct 6 ms 1900 KB Correct answer: answer = 761480
62 Correct 7 ms 1900 KB Correct answer: answer = 758932
63 Correct 6 ms 1900 KB Correct answer: answer = 1000000
64 Correct 7 ms 1976 KB Correct answer: answer = 750500
65 Correct 6 ms 1900 KB Correct answer: answer = 1000000
66 Correct 6 ms 1900 KB Correct answer: answer = 250000
67 Correct 6 ms 1900 KB Correct answer: answer = 250000
68 Correct 6 ms 1900 KB Correct answer: answer = 1000000
69 Correct 6 ms 1900 KB Correct answer: answer = 994009
70 Correct 6 ms 1900 KB Correct answer: answer = 59315
71 Correct 7 ms 1900 KB Correct answer: answer = 25454
72 Correct 6 ms 1900 KB Correct answer: answer = 1504
73 Correct 6 ms 1900 KB Correct answer: answer = 37486
74 Correct 7 ms 1900 KB Correct answer: answer = 4284
75 Correct 7 ms 1900 KB Correct answer: answer = 158008
76 Correct 6 ms 1900 KB Correct answer: answer = 51860
77 Correct 6 ms 1900 KB Correct answer: answer = 12985
78 Correct 7 ms 2028 KB Correct answer: answer = 997864126212
79 Correct 7 ms 2028 KB Correct answer: answer = 998608411647
80 Correct 7 ms 2028 KB Correct answer: answer = 995265560477
81 Correct 16 ms 2156 KB Correct answer: answer = 10125000
82 Correct 16 ms 2156 KB Correct answer: answer = 2291668
83 Correct 10 ms 2028 KB Correct answer: answer = 42388
84 Correct 10 ms 2048 KB Correct answer: answer = 10318
85 Correct 11 ms 2028 KB Correct answer: answer = 3416
86 Correct 20 ms 2156 KB Correct answer: answer = 331708193881
87 Correct 19 ms 2156 KB Correct answer: answer = 2861193756
88 Correct 19 ms 2156 KB Correct answer: answer = 114646930
89 Correct 15 ms 2156 KB Correct answer: answer = 9280921
90 Correct 15 ms 2156 KB Correct answer: answer = 999984053400
91 Correct 20 ms 2156 KB Correct answer: answer = 750935949134
92 Correct 7 ms 2028 KB Correct answer: answer = 1000000000000
93 Correct 7 ms 2028 KB Correct answer: answer = 998762383161
94 Correct 19 ms 2176 KB Correct answer: answer = 23017412908
95 Correct 7 ms 2028 KB Correct answer: answer = 728143410622
96 Correct 7 ms 2028 KB Correct answer: answer = 2
97 Correct 16 ms 2156 KB Correct answer: answer = 1824916
98 Correct 17 ms 2156 KB Correct answer: answer = 10680029
99 Correct 17 ms 2288 KB Correct answer: answer = 18351700
100 Correct 16 ms 2156 KB Correct answer: answer = 16040026
101 Correct 8 ms 2028 KB Correct answer: answer = 253968628325
102 Correct 11 ms 2028 KB Correct answer: answer = 10267
103 Correct 17 ms 2156 KB Correct answer: answer = 2582408
104 Correct 7 ms 2028 KB Correct answer: answer = 78024964781
105 Correct 8 ms 2028 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2028 KB Correct answer: answer = 3327720949
107 Correct 8 ms 2028 KB Correct answer: answer = 86064128360
108 Correct 9 ms 2028 KB Correct answer: answer = 12698259150
109 Correct 17 ms 2304 KB Correct answer: answer = 1185259288
110 Correct 24 ms 3684 KB Correct answer: answer = 999889968863
111 Correct 24 ms 3552 KB Correct answer: answer = 999861384931
112 Correct 24 ms 3552 KB Correct answer: answer = 999811809929
113 Correct 24 ms 3552 KB Correct answer: answer = 999869756441
114 Correct 144 ms 5584 KB Correct answer: answer = 1700000000
115 Correct 143 ms 5584 KB Correct answer: answer = 131666670
116 Correct 57 ms 3180 KB Correct answer: answer = 89478486
117 Correct 49 ms 3304 KB Correct answer: answer = 4971040
118 Correct 44 ms 3180 KB Correct answer: answer = 2711494
119 Correct 131 ms 5604 KB Correct answer: answer = 25252530
120 Correct 140 ms 5788 KB Correct answer: answer = 62500000
121 Correct 183 ms 5092 KB Correct answer: answer = 333175097780
122 Correct 180 ms 5092 KB Correct answer: answer = 33121180179
123 Correct 179 ms 5092 KB Correct answer: answer = 9802314015
124 Correct 132 ms 5712 KB Correct answer: answer = 32567551
125 Correct 138 ms 5604 KB Correct answer: answer = 997525000000
126 Correct 170 ms 4964 KB Correct answer: answer = 752723538884
127 Correct 18 ms 3552 KB Correct answer: answer = 1000000000000
128 Correct 22 ms 3552 KB Correct answer: answer = 999978000121
129 Correct 27 ms 3680 KB Correct answer: answer = 745986144735
130 Correct 17 ms 3552 KB Correct answer: answer = 2
131 Correct 137 ms 5700 KB Correct answer: answer = 277966670
132 Correct 136 ms 5712 KB Correct answer: answer = 2500900082
133 Correct 41 ms 3808 KB Correct answer: answer = 301248349636
134 Correct 90 ms 3556 KB Correct answer: answer = 14118891
135 Correct 25 ms 3552 KB Correct answer: answer = 14384977265
136 Correct 25 ms 3552 KB Correct answer: answer = 3681368330
137 Correct 26 ms 3552 KB Correct answer: answer = 2720316816
138 Correct 43 ms 5084 KB Correct answer: answer = 999976000144
139 Correct 43 ms 5084 KB Correct answer: answer = 999856102410
140 Correct 43 ms 5084 KB Correct answer: answer = 999958401531
141 Correct 44 ms 5084 KB Correct answer: answer = 999769649944
142 Correct 44 ms 5084 KB Correct answer: answer = 999874525918
143 Correct 287 ms 9312 KB Correct answer: answer = 6050000000
144 Correct 283 ms 9312 KB Correct answer: answer = 1112500000
145 Correct 167 ms 6884 KB Correct answer: answer = 4294967296
146 Correct 170 ms 6884 KB Correct answer: answer = 87652406
147 Correct 171 ms 6884 KB Correct answer: answer = 6297664
148 Correct 166 ms 6884 KB Correct answer: answer = 196612
149 Correct 269 ms 9536 KB Correct answer: answer = 15015100
150 Correct 254 ms 9536 KB Correct answer: answer = 25000000
151 Correct 350 ms 8288 KB Correct answer: answer = 333230209550
152 Correct 343 ms 8160 KB Correct answer: answer = 917123769
153 Correct 323 ms 8160 KB Correct answer: answer = 95162
154 Correct 265 ms 9536 KB Correct answer: answer = 382616191
155 Correct 270 ms 9540 KB Correct answer: answer = 990033333400
156 Correct 258 ms 9536 KB Correct answer: answer = 990000100000
157 Incorrect 296 ms 7776 KB Wrong answer: output = 749998188188, expected = 749998188180
158 Halted 0 ms 0 KB -