Submission #541482

# Submission time Handle Problem Language Result Execution time Memory
541482 2022-03-23T16:34:45 Z MohamedFaresNebili Last supper (IOI12_supper) C++14
0 / 100
283 ms 12784 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "advisor.h"
 
        using namespace std;
 
        using ll = long long;
        using ii = pair<ll, ll>;
 
        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll
 
        const int MOD = 1e9 + 7;
 
        void ComputeAdvice(int C[], int N, int K, int M) {
            int k = 12;
 
            for(int l = 0; l < N; l++) {
                for(int i = 0; i <= k; i++) {
                    if(C[l] & (1 << i))
                        WriteAdvice(1);
                    else WriteAdvice(0);
                }
            }
        }
 
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
/// #include "assistant.h"

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;

        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll

        const int MOD = 1e9 + 7;

        int arr[5001], pw[31], k;
        vector<int> num[5001];

        int GetRequest();
        void PutBack(int T);

        void Assist(unsigned char *A, int N, int K, int R) {

            int i; k = 12; int v = 1;

            for(int l = 0; l <= k; l++)
                pw[l] = v, v *= 2;

            int m = sizeof(A);

            for(int l = 0; l < m; l++) {
                int val = 0;
                for(i = 0; i <= k; i++) {
                    if(A[l + i] == '0') continue;
                    val += pw[k - i];
                }
                arr[val]++; num[val].pb(l); l += k;
            }

            set<int> curr;
            for(int l = 0; l < K; l++) curr.insert(l);
            for (i = 0; i < N; i++) {
                int req = GetRequest();
                if(curr.count(req)) continue;
                int in = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(arr[l] == 0) {
                        in = l; break;
                    }
                }
                if(in != -1) {
                    PutBack(in); curr.erase(in);
                    curr.insert(req); arr[req]--; continue;
                }

                int s = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(*num[l].begin() > s) {
                        s = *num[l].begin(), in = l;
                    }
                }
                PutBack(in); curr.erase(in);
                curr.insert(req); arr[req]--;
                num[in].erase(num[in].begin());
            }

        }
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 900 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 2084 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 239 ms 10288 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 644 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 273 ms 12472 KB Execution killed with signal 11
2 Runtime error 272 ms 12500 KB Execution killed with signal 11
3 Runtime error 280 ms 12536 KB Execution killed with signal 11
4 Runtime error 269 ms 12464 KB Execution killed with signal 11
5 Runtime error 264 ms 12456 KB Execution killed with signal 11
6 Runtime error 278 ms 12392 KB Execution killed with signal 11
7 Runtime error 262 ms 12440 KB Execution killed with signal 11
8 Runtime error 267 ms 12784 KB Execution killed with signal 11
9 Runtime error 283 ms 12528 KB Execution killed with signal 11
10 Runtime error 266 ms 12440 KB Execution killed with signal 11