CSES - Datatähti 2015 loppu - Results
Submission details
Task:Urkupillit
Sender:zxc
Submission time:2015-01-29 12:40:46 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:3:7: error: 'll' does not name a type
 const ll MN = 1e5+100;
       ^
input/code.cpp:4:1: error: 'll' does not name a type
 ll t[MN];
 ^
input/code.cpp: In function 'int main()':
input/code.cpp:7:9: error: 'll' was not declared in this scope
     for(ll i = 0; i < MN; ++i) t[i] = -1;
         ^
input/code.cpp:7:19: error: 'i' was not declared in this scope
     for(ll i = 0; i < MN; ++i) t[i] = -1;
                   ^
input/code.cpp:7:23: error: 'MN' was not declared in this scope
     for(ll i = 0; i < MN; ++i) t[i] = -1;
                       ^
input/code.cpp:7:32: error: 't' was not declared in this scope
     for(ll i = 0; i < MN; ++i) t[i] = -1;
                                ^
input/code.cpp:8:5: error: 'll' was not declared in this scope
     ll n,k;
     ^
input/code.cpp:9:10: error: 'n' was not declared in this scope
     cin>>n>>k;
          ^
input/code.cpp:9:13: error: 'k' was not declared in this scope
     cin>>n>>k;
             ^
input/code.cpp:10:12:...

Code

#include <iostream>
using namespace std;
const ll MN = 1e5+100;
ll t[MN];

int main() {
    for(ll i = 0; i < MN; ++i) t[i] = -1;
    ll n,k;
    cin>>n>>k;
    for(ll i = 1; i <= n; ++i) {
        if(n - i <= k) {
            t[n-i] = i;
            k -= n - i;
        }
        else {
            t[k] = i;
            ll lol = i+1;
            for(ll j = 0; j < k; ++j) {
                t[j] = lol;
                //cout<<j<<' '<<lol<<'\n';
                ++lol;
            }
            for(ll j = 0; lol <= n; ++j) {
                t[k+j+1] = lol;
                //cout<<k+j<<' '<<lol<<'\n';
                ++lol;
            }
            break;
        }
    }
    for(ll i = 0; i < n; ++i) {
        cout<<t[i]<<' ';
    }
    cout<<'\n';
}