제출 #64944

#제출 시각아이디문제언어결과실행 시간메모리
64944mirbek01팀들 (IOI15_teams)C++17
0 / 100
64 ms32216 KiB
#include "teams.h"
# include <bits/stdc++.h>

using namespace std;

int n, mt[100005], used[100005];
vector <int> a, b, g[100005];

void init(int N, int A[], int B[]) {
      n = N;
      for(int i = 0; i < n; i ++)
            a.push_back(A[i]), b.push_back(B[i]);
}

bool kuhn(int v){
      if(used[v]) return false;
      used[v] = 1;
      for(int to : g[v]){
            if(mt[to] == -1 || kuhn(mt[to])){
                  mt[to] = v;
                  return true;
            }
      }
      return false;
}

int can(int M, int K[]) {
      int sum = 0;
      for(int i = 0; i < M; i ++)
            sum += K[i];
      if(sum > n) return 0;
      for(int i = 0; i < n; i ++)
            g[i].clear();
      for(int i = 0; i < n; i ++){
            int pref = 0;
            for(int j = 0; j < M; j ++){
                  if(a[i] <= K[j] <= b[i]){
                        for(int k = pref; k < pref + K[j]; k ++){
                              g[i].push_back(k + n),
                              g[k + n].push_back(i);
                        }
                  }
                  pref += K[j];
            }
      }
      for(int i = 0; i < n + M; i ++)
            mt[i] = -1;
      for(int i = 0; i < n; i ++){
            memset(used, 0, sizeof(used));
            kuhn(i);
      }
      for(int i = 0; i < n; i ++){
            if(mt[i] != -1) sum --;
      }
      if(!sum) return 1;
      return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'int can(int, int*)':
teams.cpp:37:27: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
                   if(a[i] <= K[j] <= b[i]){
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...