Submission #462278

# Submission time Handle Problem Language Result Execution time Memory
462278 2021-08-10T09:48:52 Z dqk Job Scheduling (CEOI12_jobs) C++17
Compilation error
0 ms 0 KB
int main() {
     std::ios_base::sync_with_stdio(false);
     std::cin.tie(nullptr);
     int N, D, M;
     std::cin >> N >> D >> M;
     std::vector<std::vector<int>> a(M, std::vector<int>(2));
     for (int i = 0; i < M; ++i) {
         std::cin >> a[i][0];
         a[i][1] = i + 1;
     }
     sort(a.begin(), a.end());
     int lo = 1, hi = M;
     while (lo < hi) {
         int mi = (lo + hi) / 2;
         int task = 0;
         bool ok = true;
         for (int i = 1; i <= N; ++i) {
             int cur = 0;
             while (task < M && i >= a[task][0] && i <= a[task][0] + D && cur < mi) {
                 task++; cur++;
             }
         }
         if (task == M)
             hi = mi;
         else
             lo = mi + 1;
     }
     std::cout << lo << "\n";
     int task = 0;
     for (int i = 1; i <= N; ++i) {
         int cur = 0;
         while (task < M && i >= a[task][0] && i <= a[task][0] + D && cur < lo) {
             std::cout << a[task][1] << " ";
             task++, cur++;
         }
         std::cout << 0 << "\n";
     }
     return 0;
 }

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:2:11: error: 'std::ios_base' has not been declared
    2 |      std::ios_base::sync_with_stdio(false);
      |           ^~~~~~~~
jobs.cpp:3:11: error: 'cin' is not a member of 'std'
    3 |      std::cin.tie(nullptr);
      |           ^~~
jobs.cpp:1:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | int main() {
jobs.cpp:5:11: error: 'cin' is not a member of 'std'
    5 |      std::cin >> N >> D >> M;
      |           ^~~
jobs.cpp:5:11: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
jobs.cpp:6:11: error: 'vector' is not a member of 'std'
    6 |      std::vector<std::vector<int>> a(M, std::vector<int>(2));
      |           ^~~~~~
jobs.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | int main() {
jobs.cpp:6:23: error: 'vector' is not a member of 'std'
    6 |      std::vector<std::vector<int>> a(M, std::vector<int>(2));
      |                       ^~~~~~
jobs.cpp:6:23: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
jobs.cpp:6:30: error: expected primary-expression before 'int'
    6 |      std::vector<std::vector<int>> a(M, std::vector<int>(2));
      |                              ^~~
jobs.cpp:8:15: error: 'cin' is not a member of 'std'
    8 |          std::cin >> a[i][0];
      |               ^~~
jobs.cpp:8:15: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
jobs.cpp:8:22: error: 'a' was not declared in this scope
    8 |          std::cin >> a[i][0];
      |                      ^
jobs.cpp:11:11: error: 'a' was not declared in this scope
   11 |      sort(a.begin(), a.end());
      |           ^
jobs.cpp:11:6: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |      sort(a.begin(), a.end());
      |      ^~~~
      |      short
jobs.cpp:16:15: warning: unused variable 'ok' [-Wunused-variable]
   16 |          bool ok = true;
      |               ^~
jobs.cpp:28:11: error: 'cout' is not a member of 'std'
   28 |      std::cout << lo << "\n";
      |           ^~~~
jobs.cpp:28:11: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
jobs.cpp:33:19: error: 'cout' is not a member of 'std'
   33 |              std::cout << a[task][1] << " ";
      |                   ^~~~
jobs.cpp:33:19: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
jobs.cpp:36:15: error: 'cout' is not a member of 'std'
   36 |          std::cout << 0 << "\n";
      |               ^~~~
jobs.cpp:36:15: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?