제출 #42230

#제출 시각아이디문제언어결과실행 시간메모리
42230yusufake팀들 (IOI15_teams)C++98
34 / 100
4101 ms41924 KiB
/*
ID: ekrem
LANG: C++
TASK: teams
*/
#include <algorithm>
#include <iostream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
// #include "teams.h"
 
 
using namespace std;
#define foreach(kk,gg) for(__typeof(gg.begin())kk=gg.begin();kk!=gg.end();kk++)
#define dbgs(x) cerr << (#x) << " --> " << (x) << ' '
#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)
#define SET(a, b) memset(a, b, sizeof a)
#define heap priority_queue
#define orta (bas+son>>1)
#define endll puts("")
#define mp make_pair
#define pb push_back
#define sag (k+k+1)
#define sol (k+k)
#define endl '\n'
#define nd second
#define st first
#define y1 ekrem
#define y2 merke
typedef int don;
#define int long long int
inline don read(){don x;scanf(" %d",&x);return x;}
 
typedef pair < int , int > ii;
typedef vector < int > vi;
typedef vector < ii > vii;
 
const int inf = 1e9 + 7;
const int linf = 1e18 + 7;
 
const int NMAX = 5e5 + 5;
 
don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
int n, h[NMAX];
vi g[NMAX];
multiset < int > s;
 
don can(don M, don K[]){
 SET(h, 0);
 FOR(i, 0, M - 1)
  h[K[i]] += K[i];
 s.clear();
 FOR(i, 1, n){
  foreach(k, g[i])
   s.insert(*k);
  if(h[i]){
   int say = h[i];
   while(say and !s.empty()){
    s.erase(s.begin());
    say--;
   }
   if(say)
    return 0;
  }
  while(s.count(i))
   s.erase(i);
 }
 return 1;
}
 
void init(don N, don A[], don B[]){
 n = N;
 FOR(i, 0, N - 1)
  g[A[i]].pb(B[i]);
}

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

teams.cpp: In function 'don can(don, don*)':
teams.cpp:63:23: warning: declaration of 'K' shadows a global declaration [-Wshadow]
 don can(don M, don K[]){
                       ^
teams.cpp:58:32: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                                ^
teams.cpp:63:23: warning: declaration of 'M' shadows a global declaration [-Wshadow]
 don can(don M, don K[]){
                       ^
teams.cpp:58:29: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                             ^
teams.cpp: In function 'void init(don, don*, don*)':
teams.cpp:86:34: warning: declaration of 'B' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:17: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                 ^
teams.cpp:86:34: warning: declaration of 'A' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:8: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
        ^
teams.cpp:86:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:5: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...