답안 #635499

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635499 2022-08-26T10:44:19 Z Bruteforceman 최후의 만찬 (IOI12_supper) C++11
8 / 100
351 ms 19640 KB
    #include "advisor.h"
    #include <vector>
    #include <set>
    #include <cmath>
    using namespace std;
    void ComputeAdvice(int *C, int N, int K, int M) {
        int logn=13;
        for(int i=0;i<N;i++){
            int x=C[i];
            for(int j=0;j<logn;j++){
                if(x&1)WriteAdvice(1);
                else WriteAdvice(0);
                x/=2;
            }
        }
    }

    #include "assistant.h"
    #include <vector>
    #include <set>
    #include <cmath>
    using namespace std;
    void Assist(unsigned char *A, int N, int K, int R) {
          int logn=13;
          vector<int> V(N),cnt(N);
          set<int> S;
          set<pair<int,int>> M;
          for(int i=0;i<K;i++)S.insert(i);
          for(int i=0;i<N;i++){
            for(int j=logn-1;j>=0;j--){
                V[i]*=2;
                V[i]+=(int)(A[i*logn+j]);
            }
          }
          vector<vector<int>> needed(N,vector<int>());
          for(int i=0;i<N;i++){
            needed[V[i]].push_back(i);
          }
          for(int i=0;i<N;i++)needed[i].push_back(N);
          for(int i=0;i<K;i++){
            M.insert({-needed[i][0],i});
          }
          for (int i = 0; i < N; i++) {
            int req = GetRequest();
            if (S.find(req)==S.end()){
                auto it=M.begin();
                S.erase(it->second);
                S.insert(req);
                PutBack(it->second);
                M.erase(it);
                cnt[req]++;
                M.insert({-needed[req][cnt[req]],req});
            }
            else{
                M.erase({-needed[req][cnt[req]],req});
                cnt[req]++;
                M.insert({-needed[req][cnt[req]],req});
            }
          }
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 516 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 4 ms 664 KB Output is correct
4 Correct 12 ms 980 KB Output is correct
5 Correct 17 ms 1296 KB Output is correct
6 Correct 20 ms 1308 KB Output is correct
7 Correct 16 ms 1428 KB Output is correct
8 Correct 14 ms 1560 KB Output is correct
9 Correct 15 ms 1428 KB Output is correct
10 Correct 17 ms 1556 KB Output is correct
11 Correct 15 ms 1436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 2368 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 273 ms 15688 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 320 ms 19000 KB Output isn't correct - not an optimal way
2 Incorrect 324 ms 19108 KB Output isn't correct - not an optimal way
3 Incorrect 320 ms 19404 KB Output isn't correct - not an optimal way
4 Incorrect 341 ms 19452 KB Output isn't correct - not an optimal way
5 Incorrect 320 ms 19416 KB Output isn't correct - not an optimal way
6 Incorrect 335 ms 19640 KB Output isn't correct - not an optimal way
7 Incorrect 351 ms 19300 KB Output isn't correct - not an optimal way
8 Incorrect 339 ms 19364 KB Output isn't correct - not an optimal way
9 Incorrect 341 ms 19496 KB Output isn't correct - not an optimal way
10 Incorrect 343 ms 19380 KB Output isn't correct - not an optimal way