제출 #32301

#제출 시각아이디문제언어결과실행 시간메모리
32301imaxblueJob Scheduling (CEOI12_jobs)C++14
100 / 100
393 ms9644 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define pq priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define fox1r(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) #define rng() (rand() >> 3)*rand() int n, k, t, a, lo, hi=1000000, mid; vector<int> v[100005]; bool f; queue<pii> q; bool check(int L){ while(!q.empty()) q.pop(); fox1(l, n){ fox(l2, v[l].size()) q.push(mp(l, v[l][l2])); for(int l2=0; l2<L && q.size(); ++l2){ if (l-q.front().x>k) return 0; if (f) printf("%i ", q.front().y+1); q.pop(); } if (f) printf("0\n"); } return 1; } int main(){ scanf("%i%i%i", &n, &k, &t); fox(l, t){ scanf("%i", &a); v[a].pb(l); } while(lo<hi){ mid=(lo+hi)/2; if (check(mid)) hi=mid; else lo=mid+1; } f=1; printf("%i\n", lo); check(lo); return 0; }

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

jobs.cpp: In function 'bool check(int)':
jobs.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
jobs.cpp:34:9: note: in expansion of macro 'fox'
         fox(l2, v[l].size()) q.push(mp(l, v[l][l2]));
         ^
jobs.cpp: In function 'int main()':
jobs.cpp:47:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i%i", &n, &k, &t);
                                ^
jobs.cpp:49:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i", &a);
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...