제출 #1296712

#제출 시각아이디문제언어결과실행 시간메모리
1296712SunbaeJob Scheduling (CEOI12_jobs)C++17
0 / 100
145 ms16740 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<int> e[N]; signed main(){ int n, d, m; scanf("%d %d %d", &n, &d, &m); for(int i = 0, x; i<m; ++i){ scanf("%d", &x); e[x-1].push_back(i); } int low = 1, high = m, ans = 0; while(low <= high){ int mid = (low + high)>>1; queue<int> q; for(int d = 0; d<n; ++d){ for(int x: e[d]) q.push(x); for(int i = 0; !q.empty() && i<mid; ++i) q.pop(); } if(q.size()/mid <= d) high = (ans = mid)-1; else low = mid+1; } printf("%d\n", ans); queue<int> q; for(int d = 0; d<n; ++d){ for(int x: e[d]) q.push(x); for(int i = 0; !q.empty() && i<ans; ++i){ printf("%d ", q.front()+1); q.pop(); } if(d == n-1) printf("0"); else puts("0"); } }

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

jobs.cpp: In function 'int main()':
jobs.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     int n, d, m; scanf("%d %d %d", &n, &d, &m);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
jobs.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...