제출 #637362

#제출 시각아이디문제언어결과실행 시간메모리
637362MohamedFaresNebili팀들 (IOI15_teams)C++14
0 / 100
4067 ms27000 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; const int INF = INT32_MAX; const int batch = 750; vector<pair<int, int>> arr; int ST[800005]; void init(int N, int A[], int B[]) { for(int i = 0; i < N; i++) { int U = A[i], V = B[i]; arr.push_back({U, V}); } } int can(int M, int K[]) { int N = arr.size(); vector<int> adj[N]; vector<int> order(N, 0), calc(M, 0); for(int l = 0; l < N; l++) { order[l] = l; int U = arr[l].first, V = arr[l].second; for(int i = 0; i < M; i++) if(K[i] >= U && K[i] <= V) adj[l].push_back(i), calc[i]++; } vector<int> cur(M, 0); int res = 1; sort(order.begin(), order.end(), [&](int A, int B) { return adj[A].size() < adj[B].size(); }); for(int l = 0; l < N; l++) { sort(adj[order[l]].begin(), adj[order[l]].end(), [&](int A, int B) { return calc[A] < calc[B]; }); } for(int l = 0; l < N; l++) { int i = order[l]; for(auto u : adj[i]) { if(cur[u] < K[u]) { cur[u]++; break; } } } for(int l = 0; l < M; l++) res &= (cur[l] == K[l]); ///cout << res << "\n"; return res; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:20:33: warning: conversion from 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   20 |                 int N = arr.size(); vector<int> adj[N];
      |                         ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...