답안 #702527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
702527 2023-02-24T09:57:48 Z Ronin13 최후의 만찬 (IOI12_supper) C++14
0 / 100
80 ms 6324 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pb push_back
#define epb emplace_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#include "advisor.h"
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    int n = N, k = K;
  int last[N];
  fill(last, last + N, n + 1);
  set <int> st;
  vector <int> vec;
  for(int i = N - 1; i >= 0; i--){
        int x = last[C[i]];
        st.erase(x);
        st.insert(i);
        last[C[i]] = i;
        if(st.size() > k)
            vec.pb(1), st.erase(*st.rbegin());
        else vec.pb(0);
  }
  for(int i = k - 1; i >= 0; i--){
    if(st.find(last[i]) == st.end()){
        vec.pb(1);
    }
    else vec.pb(0);
  }

  for(int i = vec.size() - 1; i >= 0; i--)
    WriteAdvice(vec[i]);
}
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pb push_back
#define epb emplace_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>

#include "assistant.h"
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {

    int n = N, k = K;
    queue <int> q;
    vector <bool> used(n, false);
    for(int i = 0; i < k; i++){
        if(A[i] == 1)
            q.push(i);
        used[i] = true;
    }

    int val = k;
    for(int i = k; i < n + k; i++){
        int x = GetRequest();
        val++;
        if(val > k && !used[x]){
            int v = q.front();
            PutBack(v);
            used[v] = false;
            q.pop();
            val--;
        }
        used[x] = true;
        if(A[i] == 1)
            q.push(x);
    }
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:23:22: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         if(st.size() > k)
      |            ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 1 ms 520 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1152 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 4988 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 792 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 6004 KB Output isn't correct - not an optimal way
2 Incorrect 69 ms 6044 KB Output isn't correct - not an optimal way
3 Incorrect 72 ms 6124 KB Output isn't correct - not an optimal way
4 Incorrect 68 ms 6140 KB Output isn't correct - not an optimal way
5 Incorrect 75 ms 6100 KB Output isn't correct - not an optimal way
6 Incorrect 72 ms 6324 KB Output isn't correct - not an optimal way
7 Incorrect 77 ms 6080 KB Output isn't correct - not an optimal way
8 Incorrect 73 ms 6056 KB Output isn't correct - not an optimal way
9 Incorrect 69 ms 6160 KB Output isn't correct - not an optimal way
10 Incorrect 80 ms 6156 KB Output isn't correct - not an optimal way