Submission #285690

# Submission time Handle Problem Language Result Execution time Memory
285690 2020-08-29T12:27:31 Z wildturtle Rack (eJOI19_rack) C++14
40 / 100
130 ms 102404 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,X[500005],x;
vector <long long> v;
int main() {
    cin>>n>>k;
    X[0]=1;
    for(long long i=1;i<=n;i++) {
        X[i]=X[i-1]*2;
    }
    if(k==1) { cout<<1; return 0; }
    v.push_back(1);
    x=n;
    while(true) {
        x--;
        a=v.size();
        for(long long i=0;i<a;i++) {
            v.push_back(v[i]+X[x]);
        }
        if(v.size()>=k) break;
    }
    cout<<v[k-1];
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:20:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   20 |         if(v.size()>=k) break;
      |            ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 1020 KB Output is correct
9 Correct 3 ms 2548 KB Output is correct
10 Correct 4 ms 2548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 1020 KB Output is correct
9 Correct 3 ms 2548 KB Output is correct
10 Correct 4 ms 2548 KB Output is correct
11 Runtime error 130 ms 102404 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -