답안 #386214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
386214 2021-04-06T06:01:12 Z tko919 Aliens (IOI16_aliens) C++17
25 / 100
33 ms 1056 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

struct CHT{
   int n; vector<ll> xs,p,q; vector<bool> used;
   CHT(const vector<ll>& ps){
      n=1; while(n<(int)ps.size())n<<=1;
      used.assign(4*n,0); xs.resize(4*n,inf);
      p.resize(4*n); q.resize(4*n);
      rep(i,0,ps.size())xs[i]=ps[i];
   }
   void add(ll a,ll b,int k=0,int l=0,int r=-1){
      if(r==-1)r=n;
      while(r-l>0){
         int m=(l+r)>>1;
         if(!used[k]){
            p[k]=a; q[k]=b; used[k]=1;
            return;
         }
         ll lx=xs[l],mx=xs[m],rx=xs[r-1];
         ll pk=p[k],qk=q[k];
         bool lb=(a*lx+b<pk*lx+qk);
         bool mid=(a*mx+b<pk*mx+qk);
         bool rb=(a*rx+b<pk*rx+qk);
         if(lb&&rb){p[k]=a; q[k]=b; return;}
         if(!lb&&!rb)return;
         if(mid){swap(p[k],a); swap(q[k],b);}
         if(lb!=mid){k=2*k+1; r=m;} else{k=2*k+2; l=m;}
      }
   }
   void add_segment(ll a,ll b,int l,int r){
      ll l0=l+n,r0=r+n,s0=l,t0=r,sz=1;
      while(l0<r0){
         if(r0&1){r0--; t0-=sz; add(a,b,r0-1,t0,t0+sz);}
         if(l0&1){add(a,b,l0-1,s0,s0+sz); l0++; s0+=sz;}
         l0>>=1; r0>>=1; sz<<=1;
      }
   }
   pair<ll,ll> query(int i){
      int k=i+n-1;
      ll ami=-1,x=xs[i],s=INF;
      if(used[k]){
         s=p[k]*x+q[k];
         ami=p[k];
      }
      while(k){
         k=(k-1)>>1;
         if(used[k]){
            if(chmin(s,p[k]*x+q[k]))ami=p[k];
         }
      } return {s,ami};
   }
};
 
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
   using P=pair<ll,ll>;
   vector<P> pos,used;
   rep(i,0,n){
      if(r[i]>c[i])swap(r[i],c[i]);
      c[i]++;
      pos.push_back({r[i],c[i]});
   }
   sort(ALL(pos),[](P& a,P& b){
      if(a.first==b.first)return a.second>b.second;
      else return a.first<b.first;
   });
   ll mx=-1;
   rep(i,0,n){
      if(!chmax(mx,pos[i].second))continue;
      used.push_back(pos[i]);
   }
   n=used.size();
   r.clear();
   c.clear();
   for(auto& [x,y]:used){
      r.push_back(x);
      c.push_back(y);
   }
   
   auto get=[&](ll pena)->P{
      vector<ll> ps,dp(n+10,INF),dp2(n+10,INF);
      dp[0]=dp2[0]=0;
      
      rep(i,0,n)ps.push_back(c[i]);
      CHT cht(ps);
      rep(i,0,n){
         ll b=dp[i]+ll(r[i])*r[i];
         if(i and c[i-1]>r[i])b-=ll(c[i-1]-r[i])*(c[i-1]-r[i]);
         cht.add(-2LL*r[i],b);
         auto [v,a]=cht.query(i);
         int pre=lower_bound(ALL(r),-a/2)-r.begin();
         if(chmin(dp[i+1],v+ll(c[i])*c[i]+pena)){
            chmin(dp2[i+1],dp2[pre]+1);
         }
      }
      return {dp[n],dp2[n]};
   };

   if(k>=n){
      return get(0).first;
   }
   ll lb=-1,rb=1e13;
   while(rb-lb>1){
      ll mid=(lb+rb)>>1;
      if(get(mid).second<=k)rb=mid;
      else lb=mid;
   }
   return get(rb).first-rb*k;
}
 
/*
int main() {
    int n, m, k;
    assert(3 == scanf("%d %d %d", &n, &m, &k));
    std::vector<int> r(n), c(n);
    for (int i = 0; i < n; i++) {
        assert(2 == scanf("%d %d", &r[i], &c[i]));
    }
    long long ans = take_photos(n, m, k, r, c);
    
    
    printf("%lld\n", ans);
    return 0;
}
//*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 2 ms 364 KB Correct answer: answer = 4
4 Correct 2 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 1 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 1 ms 384 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 384 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 384 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 2 ms 364 KB Correct answer: answer = 4
3 Correct 2 ms 372 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 3 ms 364 KB Correct answer: answer = 764
9 Correct 3 ms 364 KB Correct answer: answer = 250000
10 Correct 1 ms 364 KB Correct answer: answer = 500
11 Correct 1 ms 364 KB Correct answer: answer = 32
12 Correct 3 ms 364 KB Correct answer: answer = 130050
13 Correct 4 ms 364 KB Correct answer: answer = 5110
14 Correct 2 ms 364 KB Correct answer: answer = 2626
15 Correct 2 ms 364 KB Correct answer: answer = 796
16 Correct 4 ms 364 KB Correct answer: answer = 7580
17 Correct 4 ms 364 KB Correct answer: answer = 1904
18 Correct 3 ms 364 KB Correct answer: answer = 996004
19 Correct 3 ms 364 KB Correct answer: answer = 38817
20 Correct 3 ms 364 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 4 ms 364 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 2 ms 364 KB Correct answer: answer = 4
4 Correct 2 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 1 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 1 ms 384 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 384 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 384 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 2 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 372 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 3 ms 364 KB Correct answer: answer = 764
29 Correct 3 ms 364 KB Correct answer: answer = 250000
30 Correct 1 ms 364 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 3 ms 364 KB Correct answer: answer = 130050
33 Correct 4 ms 364 KB Correct answer: answer = 5110
34 Correct 2 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 364 KB Correct answer: answer = 796
36 Correct 4 ms 364 KB Correct answer: answer = 7580
37 Correct 4 ms 364 KB Correct answer: answer = 1904
38 Correct 3 ms 364 KB Correct answer: answer = 996004
39 Correct 3 ms 364 KB Correct answer: answer = 38817
40 Correct 3 ms 364 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 4 ms 364 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 496 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 1 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 1 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 4 ms 364 KB Correct answer: answer = 63501
59 Correct 4 ms 364 KB Correct answer: answer = 323501
60 Correct 4 ms 364 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 2 ms 364 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 2 ms 364 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 1 ms 384 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 3 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 384 KB Correct answer: answer = 25454
72 Correct 3 ms 364 KB Correct answer: answer = 1504
73 Correct 2 ms 364 KB Correct answer: answer = 37486
74 Correct 3 ms 364 KB Correct answer: answer = 4284
75 Correct 1 ms 364 KB Correct answer: answer = 158008
76 Correct 1 ms 364 KB Correct answer: answer = 51860
77 Correct 2 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 2 ms 364 KB Correct answer: answer = 4
4 Correct 2 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 1 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 1 ms 384 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 384 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 384 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 2 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 372 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 3 ms 364 KB Correct answer: answer = 764
29 Correct 3 ms 364 KB Correct answer: answer = 250000
30 Correct 1 ms 364 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 3 ms 364 KB Correct answer: answer = 130050
33 Correct 4 ms 364 KB Correct answer: answer = 5110
34 Correct 2 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 364 KB Correct answer: answer = 796
36 Correct 4 ms 364 KB Correct answer: answer = 7580
37 Correct 4 ms 364 KB Correct answer: answer = 1904
38 Correct 3 ms 364 KB Correct answer: answer = 996004
39 Correct 3 ms 364 KB Correct answer: answer = 38817
40 Correct 3 ms 364 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 4 ms 364 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 496 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 1 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 1 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 4 ms 364 KB Correct answer: answer = 63501
59 Correct 4 ms 364 KB Correct answer: answer = 323501
60 Correct 4 ms 364 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 2 ms 364 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 2 ms 364 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 1 ms 384 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 3 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 384 KB Correct answer: answer = 25454
72 Correct 3 ms 364 KB Correct answer: answer = 1504
73 Correct 2 ms 364 KB Correct answer: answer = 37486
74 Correct 3 ms 364 KB Correct answer: answer = 4284
75 Correct 1 ms 364 KB Correct answer: answer = 158008
76 Correct 1 ms 364 KB Correct answer: answer = 51860
77 Correct 2 ms 364 KB Correct answer: answer = 12985
78 Correct 4 ms 620 KB Correct answer: answer = 997864126212
79 Correct 2 ms 620 KB Correct answer: answer = 998608411647
80 Correct 2 ms 620 KB Correct answer: answer = 995265560477
81 Correct 29 ms 1056 KB Correct answer: answer = 10125000
82 Correct 33 ms 1056 KB Correct answer: answer = 2291668
83 Incorrect 18 ms 748 KB Wrong answer: output = 42387, expected = 42388
84 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 2 ms 364 KB Correct answer: answer = 4
4 Correct 2 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 1 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 1 ms 384 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 384 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 384 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 2 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 372 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 3 ms 364 KB Correct answer: answer = 764
29 Correct 3 ms 364 KB Correct answer: answer = 250000
30 Correct 1 ms 364 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 3 ms 364 KB Correct answer: answer = 130050
33 Correct 4 ms 364 KB Correct answer: answer = 5110
34 Correct 2 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 364 KB Correct answer: answer = 796
36 Correct 4 ms 364 KB Correct answer: answer = 7580
37 Correct 4 ms 364 KB Correct answer: answer = 1904
38 Correct 3 ms 364 KB Correct answer: answer = 996004
39 Correct 3 ms 364 KB Correct answer: answer = 38817
40 Correct 3 ms 364 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 4 ms 364 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 496 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 1 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 1 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 4 ms 364 KB Correct answer: answer = 63501
59 Correct 4 ms 364 KB Correct answer: answer = 323501
60 Correct 4 ms 364 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 2 ms 364 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 2 ms 364 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 1 ms 384 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 3 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 384 KB Correct answer: answer = 25454
72 Correct 3 ms 364 KB Correct answer: answer = 1504
73 Correct 2 ms 364 KB Correct answer: answer = 37486
74 Correct 3 ms 364 KB Correct answer: answer = 4284
75 Correct 1 ms 364 KB Correct answer: answer = 158008
76 Correct 1 ms 364 KB Correct answer: answer = 51860
77 Correct 2 ms 364 KB Correct answer: answer = 12985
78 Correct 4 ms 620 KB Correct answer: answer = 997864126212
79 Correct 2 ms 620 KB Correct answer: answer = 998608411647
80 Correct 2 ms 620 KB Correct answer: answer = 995265560477
81 Correct 29 ms 1056 KB Correct answer: answer = 10125000
82 Correct 33 ms 1056 KB Correct answer: answer = 2291668
83 Incorrect 18 ms 748 KB Wrong answer: output = 42387, expected = 42388
84 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Correct answer: answer = 4
2 Correct 1 ms 364 KB Correct answer: answer = 4
3 Correct 2 ms 364 KB Correct answer: answer = 4
4 Correct 2 ms 364 KB Correct answer: answer = 12
5 Correct 1 ms 364 KB Correct answer: answer = 52
6 Correct 1 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 1 ms 384 KB Correct answer: answer = 7550
15 Correct 1 ms 364 KB Correct answer: answer = 7220
16 Correct 1 ms 384 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 384 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 2 ms 364 KB Correct answer: answer = 4
23 Correct 2 ms 372 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 3 ms 364 KB Correct answer: answer = 764
29 Correct 3 ms 364 KB Correct answer: answer = 250000
30 Correct 1 ms 364 KB Correct answer: answer = 500
31 Correct 1 ms 364 KB Correct answer: answer = 32
32 Correct 3 ms 364 KB Correct answer: answer = 130050
33 Correct 4 ms 364 KB Correct answer: answer = 5110
34 Correct 2 ms 364 KB Correct answer: answer = 2626
35 Correct 2 ms 364 KB Correct answer: answer = 796
36 Correct 4 ms 364 KB Correct answer: answer = 7580
37 Correct 4 ms 364 KB Correct answer: answer = 1904
38 Correct 3 ms 364 KB Correct answer: answer = 996004
39 Correct 3 ms 364 KB Correct answer: answer = 38817
40 Correct 3 ms 364 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 4 ms 364 KB Correct answer: answer = 2040
44 Correct 1 ms 364 KB Correct answer: answer = 2
45 Correct 1 ms 496 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 1 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 1 ms 364 KB Correct answer: answer = 484
57 Correct 1 ms 364 KB Correct answer: answer = 484
58 Correct 4 ms 364 KB Correct answer: answer = 63501
59 Correct 4 ms 364 KB Correct answer: answer = 323501
60 Correct 4 ms 364 KB Correct answer: answer = 752500
61 Correct 2 ms 364 KB Correct answer: answer = 761480
62 Correct 2 ms 364 KB Correct answer: answer = 758932
63 Correct 1 ms 364 KB Correct answer: answer = 1000000
64 Correct 2 ms 364 KB Correct answer: answer = 750500
65 Correct 2 ms 364 KB Correct answer: answer = 1000000
66 Correct 1 ms 384 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 3 ms 364 KB Correct answer: answer = 59315
71 Correct 2 ms 384 KB Correct answer: answer = 25454
72 Correct 3 ms 364 KB Correct answer: answer = 1504
73 Correct 2 ms 364 KB Correct answer: answer = 37486
74 Correct 3 ms 364 KB Correct answer: answer = 4284
75 Correct 1 ms 364 KB Correct answer: answer = 158008
76 Correct 1 ms 364 KB Correct answer: answer = 51860
77 Correct 2 ms 364 KB Correct answer: answer = 12985
78 Correct 4 ms 620 KB Correct answer: answer = 997864126212
79 Correct 2 ms 620 KB Correct answer: answer = 998608411647
80 Correct 2 ms 620 KB Correct answer: answer = 995265560477
81 Correct 29 ms 1056 KB Correct answer: answer = 10125000
82 Correct 33 ms 1056 KB Correct answer: answer = 2291668
83 Incorrect 18 ms 748 KB Wrong answer: output = 42387, expected = 42388
84 Halted 0 ms 0 KB -