답안 #883177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
883177 2023-12-04T17:44:13 Z Almonther Rack (eJOI19_rack) C++
40 / 100
20 ms 464 KB
#include <bits/stdc++.h>
 
#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
#define ld long double
#define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
#define co cout <<
#define MOD 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
//stuff
ll n,k;
pair<ll,ll>arr[1000001]={};
ll multi[21]={};
void solve(){
    cin>>n>>k;
    ll cnt=0;
    ll last;
    multi[0]=1;
    for(int i=1;i<=n;i++){
        multi[i]=multi[i-1]*2;
    }
    while(cnt!=k){
        ll r=1;
        for(int i=n;i>0;i--){
            if(arr[i].second==1){
                r+=multi[i]/2;
            }
            arr[i].first++;
            if(arr[i].first%multi[n-i]==0){
                arr[i].first=0;
                arr[i].second=!arr[i].second;
            }
        }
        cnt++;
        last=r;
    }
    co last;
    
}
 
int main()
{
    suiii
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 360 KB Output is correct
4 Correct 0 ms 464 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 360 KB Output is correct
4 Correct 0 ms 464 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 5 ms 464 KB Output is correct
9 Correct 15 ms 344 KB Output is correct
10 Correct 20 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 360 KB Output is correct
4 Correct 0 ms 464 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 5 ms 464 KB Output is correct
9 Correct 15 ms 344 KB Output is correct
10 Correct 20 ms 348 KB Output is correct
11 Runtime error 1 ms 448 KB Execution killed with signal 8
12 Halted 0 ms 0 KB -