CSES - Datatähti 2023 alku - Results
Submission details
Task:Lista
Sender:stpn129
Submission time:2022-11-13 14:32:35 +0200
Language:text (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details

Code

#include <bits/stdc++.h>
#define int long long
using namespace std;


 
void init_code() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE

  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
} 

signed main() {
    mt19937 rand(static_cast<unsigned int>(time(0)));
    init_code();

    vector<int> q = {0, 58667, 68283, 64141, 69169, 67564, 63729, 57461, 50514, 49078, 41270, 33328, 33181, 22058, 16443, 19680, 28220, 46548, 54913, 59232, 53046, 33801, 21281, 18002, 16852, 14723, 25344, 41021, 42314, 32321, 24947, 40411, 64014, 68201, 65541, 70605, 61078, 34269, 18058, 19618, 21052, 19631, 18710, 23940, 32377, 41888, 39379, 28622, 30106, 38148, 44813, 37202, 31083, 48031, 70527, 66942, 53957, 49584, 49344, 39057, 28039, 34540, 30821, 25220, 19045, 22785, 23319, 34534, 40534, 29218, 45518, 61947, 65846, 73052, 76934, 75406, 75832, 75281, 72261, 67047, 64983, 54868, 36847, 23436, 25757, 34897, 36784, 25072, 22286, 34411, 43688, 41562, 30050, 38453, 54494, 49373, 38474, 42651, 51908, 67251, 79645};
    vector<int> used(2023 + 1, 0);
    vector<int> a(2023 + 1, 0);
    vector<int> inp = {0, 1991,1845,1968,1757,1414,1271,1832,526,335,1253,1742,1957,930,1270,410,1790,705,1338,1255,614,1805,1835,1729,1215,1783,1025,983,1907,1297,1974,1978,1103,1777,1328,1356,1013,1059,1713,1437,100,1792,991,1264};
    
    for (int i = 1; i <= 43; i++) {
        a[i] = inp[i];
    }

    used[0] = 1;

    int st = 1, fn = 2023;
    int j = 21;
    for (int i = 2; i <= 100; i++) {
        int s = 0, m = j + 42, x = 0;
        //cout << j << ' ' << m << '\n';
        for (int k = j; k <= m; k++) {
            if (a[k] != 0) {
                used[a[k]] = 1; 
                s += a[k];
                continue;
            }
            
            if (k != m) {    
                x =  st + rand() % (fn - st + 1);
                while(used[x]) {
                    x = st + rand() % (fn - st + 1);
                }
                used[x] = 1;
                a[k] = x;
                s += x;
                continue;
            } 
            
            if ((q[i] - s) >= 1 && (q[i] - s) <= 2023  && used[q[i] - s] != 1) {
               used[q[i] - s] = 1;
               a[k] = q[i] - s;
            } else { 
                x =  st + rand() % (fn - st + 1);
                while(used[x]) {
                    x = st + rand() % (fn - st + 1);
                }
                used[x] = 1;
                a[k] = x;
                s += x;
                continue;
            }
            
        }
        j += 20;
    }

    for (int i = 1; i <= 2023; i++) {
        cout << a[i] << ' ';
    }
    return 0;
}

Test details

Test 1

Verdict:

input
58667 68283 64141 69169 67564 ...

correct output
688 488 1060 602 1171 471 322 ...

user output
#include <bits/stdc++.h>
#define int long long
using namespace std;


...