Submission #1084554

#TimeUsernameProblemLanguageResultExecution timeMemory
1084554rayan_bdJob Scheduling (CEOI12_jobs)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ii pair<ll, ll> #define fi first #define se second int n, d, m; vector<ii> stX(1000001); vector<int> ans[100001]; bool f(int x) { for(int day=1, j=1; day<=m && j<=n; ++day) for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i) if (day>stX[j++].fi+d) return 0; return 1; } void trace(int x) { for(int day=1, j=1; day<=m && j<=n; ++day) for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i) ans[day].push_back(stX[j++].se); } int main() { cin.tie(0) -> sync_with_stdio(0); cout.tie(0); cin >> m >> d >> n; for(int i=1; i<=n; ++i) { cin >> stX[i].fi; stX[i].se=i; } sort(stX.begin()+1, stX.begin()+n+1); int lb=1, rb=n+1, mb; while (lb<rb) { mb=(lb+rb)>>1; if (f(mb)) rb=mb; else lb=mb+1; } trace(lb); cout << lb << '\n'; for(int i=1; i<=m; ++i) { for(int j: ans[i]) cout << j << ' '; cout << "0\n"; } }

Compilation message (stderr)

jobs.cpp:4:17: error: 'll' was not declared in this scope
    4 | #define ii pair<ll, ll>
      |                 ^~
jobs.cpp:9:8: note: in expansion of macro 'ii'
    9 | vector<ii> stX(1000001);
      |        ^~
jobs.cpp:4:21: error: 'll' was not declared in this scope
    4 | #define ii pair<ll, ll>
      |                     ^~
jobs.cpp:9:8: note: in expansion of macro 'ii'
    9 | vector<ii> stX(1000001);
      |        ^~
jobs.cpp:4:23: error: template argument 1 is invalid
    4 | #define ii pair<ll, ll>
      |                       ^
jobs.cpp:9:8: note: in expansion of macro 'ii'
    9 | vector<ii> stX(1000001);
      |        ^~
jobs.cpp:4:23: error: template argument 2 is invalid
    4 | #define ii pair<ll, ll>
      |                       ^
jobs.cpp:9:8: note: in expansion of macro 'ii'
    9 | vector<ii> stX(1000001);
      |        ^~
jobs.cpp:9:10: error: template argument 1 is invalid
    9 | vector<ii> stX(1000001);
      |          ^
jobs.cpp:9:10: error: template argument 2 is invalid
jobs.cpp: In function 'bool f(int)':
jobs.cpp:14:35: error: invalid types 'int[int]' for array subscript
   14 |   for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i)
      |                                   ^
jobs.cpp:15:15: error: invalid types 'int[int]' for array subscript
   15 |    if (day>stX[j++].fi+d)
      |               ^
jobs.cpp: In function 'void trace(int)':
jobs.cpp:22:35: error: invalid types 'int[int]' for array subscript
   22 |   for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i)
      |                                   ^
jobs.cpp:23:26: error: invalid types 'int[int]' for array subscript
   23 |    ans[day].push_back(stX[j++].se);
      |                          ^
jobs.cpp: In function 'int main()':
jobs.cpp:32:13: error: invalid types 'int[int]' for array subscript
   32 |   cin >> stX[i].fi;
      |             ^
jobs.cpp:33:6: error: invalid types 'int[int]' for array subscript
   33 |   stX[i].se=i;
      |      ^
jobs.cpp:36:11: error: request for member 'begin' in 'stX', which is of non-class type 'int'
   36 |  sort(stX.begin()+1, stX.begin()+n+1);
      |           ^~~~~
jobs.cpp:36:26: error: request for member 'begin' in 'stX', which is of non-class type 'int'
   36 |  sort(stX.begin()+1, stX.begin()+n+1);
      |                          ^~~~~