제출 #1034406

#제출 시각아이디문제언어결과실행 시간메모리
1034406Zicrus팀들 (IOI15_teams)C++17
34 / 100
4080 ms24204 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; typedef long long ll; ll n; vector<pair<ll, ll>> a; void init(int n1, int a1[], int b1[]) { n = n1; a = vector<pair<ll, ll>>(n); for (int i = 0; i < n; i++) { a[i].first = a1[i]; a[i].second = b1[i]; } sort(a.begin(), a.end()); reverse(a.begin(), a.end()); } int can(int m, int k[]) { vector<ll> q(m); for (int i = 0; i < m; i++) q[i] = k[i]; sort(q.begin(), q.end()); reverse(q.begin(), q.end()); vector<bool> used(n); vector<ll> red(n); for (auto &e : q) { ll cnt = e; ll id = 0; for (int i = red[0]; i < n && cnt; i += 1 + red[i+1]) { if (used[i]) { red[id]++; continue; } id = i+1; pair<ll, ll> &s = a[i]; if (s.first > e) { used[i] = true; continue; } if (s.second >= e) { used[i] = true; cnt--; } } if (cnt) return 0; } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:32:21: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   32 |   for (int i = red[0]; i < n && cnt; i += 1 + red[i+1]) {
      |                     ^
teams.cpp:32:54: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   32 |   for (int i = red[0]; i < n && cnt; i += 1 + red[i+1]) {
      |                                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...