Submission #3878844


Source Code Expand

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

vector<ll> a;

int main(){
    vector<ll> dp(5000);
    dp[0] = 1;
    int c = 0;
    ll k;
    cin >> k;
    ll sm = 0;
    for(int i=1;i<210;i++){
        bool flag = 0;
        if(i%8!=0){
            for(int j=i-1;j>=0;j-=8){
                dp[i] += dp[j];
                
            }
        }
        //cerr << dp[i] << " ";
        if(i%8==7){
            if(dp[i]<(ll)1e18){
                if(sm+dp[i]>k){
                    flag = 1;
                    break;
                }
                a.PB(dp[i]);
                c++;
                sm += dp[i];
            }else{
                flag = 1;
                break;
            }
        }
        if(flag)break;
    }
    
    vector<ll> cnt(c);
    for(int i=c-1;i>=0;i--){
        cnt[i] = (k-sm)/a[i];
        k -= a[i]*cnt[i];
        cnt[i]++;
    }
    // rep(i,c){
    //     cerr << a[i] << " " << cnt[i] << endl;
    // }
    string ans;
    for(int i=c-1;i>=0;i--){
        for(int j=0;j<cnt[i];j++){
            ans += "F";
        }
        ans +="ESTIVAL";
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task G - FESTIVAL
User mtsd
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1634 Byte
Status WA
Exec Time 2104 ms
Memory 211032 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1000
Status
AC × 1
WA × 1
AC × 2
WA × 14
TLE × 40
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 8 ms 888 KB
001.txt WA 1 ms 256 KB
002.txt WA 1 ms 256 KB
003.txt WA 1 ms 256 KB
004.txt WA 1 ms 256 KB
005.txt WA 1 ms 256 KB
006.txt WA 1 ms 256 KB
007.txt WA 1 ms 256 KB
008.txt WA 1 ms 256 KB
009.txt WA 1 ms 256 KB
010.txt WA 3 ms 704 KB
011.txt WA 3 ms 512 KB
012.txt WA 110 ms 14568 KB
013.txt WA 1772 ms 211032 KB
014.txt TLE 2104 ms 198876 KB
015.txt TLE 2104 ms 198492 KB
016.txt TLE 2104 ms 198620 KB
017.txt TLE 2104 ms 198748 KB
018.txt TLE 2104 ms 197212 KB
019.txt TLE 2104 ms 198492 KB
020.txt TLE 2104 ms 199004 KB
021.txt TLE 2104 ms 197468 KB
022.txt TLE 2104 ms 197596 KB
023.txt TLE 2104 ms 197212 KB
024.txt TLE 2104 ms 198492 KB
025.txt TLE 2104 ms 198108 KB
026.txt TLE 2104 ms 198620 KB
027.txt TLE 2104 ms 198876 KB
028.txt TLE 2104 ms 199004 KB
029.txt TLE 2104 ms 198108 KB
030.txt TLE 2104 ms 197596 KB
031.txt TLE 2104 ms 197852 KB
032.txt TLE 2104 ms 198364 KB
033.txt TLE 2104 ms 197980 KB
034.txt TLE 2104 ms 199004 KB
035.txt TLE 2104 ms 197340 KB
036.txt TLE 2104 ms 197212 KB
037.txt TLE 2104 ms 197468 KB
038.txt TLE 2104 ms 198748 KB
039.txt TLE 2104 ms 198364 KB
040.txt TLE 2104 ms 197212 KB
041.txt TLE 2104 ms 197468 KB
042.txt TLE 2104 ms 197724 KB
043.txt TLE 2104 ms 198108 KB
044.txt TLE 2104 ms 197852 KB
045.txt TLE 2104 ms 197852 KB
046.txt TLE 2104 ms 198236 KB
047.txt TLE 2104 ms 198876 KB
048.txt TLE 2104 ms 197340 KB
049.txt TLE 2104 ms 198108 KB
050.txt TLE 2104 ms 198236 KB
051.txt TLE 2104 ms 197980 KB
052.txt TLE 2104 ms 197468 KB
053.txt TLE 2104 ms 197724 KB
example0.txt AC 1 ms 256 KB
example1.txt WA 1 ms 256 KB