Submission #640063

#TimeUsernameProblemLanguageResultExecution timeMemory
640063Trisanu_DasJob Scheduling (CEOI12_jobs)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int M = 1000005; #define ff first #define ss second int n, d, m; pair <int,int> tasks[M]; bool check(int mid){ int pos = 1; for(int i = 1; i <= n; ++i) for(int j = 1; j <= mid && pos <= m && tasks[pos].ff <= i; ++j) if(i - tasks[pos++].ff > d) return false; return (pos == m + 1); } int main(){ cin >> n >> d >> m; for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, #include <bits/stdc++.h> using namespace std; const int M = 1000005; #define ff first #define ss second int n, d, m; pair <int,int> tasks[M]; bool check(int mid){ int pos = 1; for(int i = 1; i <= n; ++i) for(int j = 1; j <= mid && pos <= m && tasks[pos].ff <= i; ++j) if(i - tasks[pos++].ff > d) return false; return (pos == m + 1); } int main(){ cin >> n >> d >> m; for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, tasks[i].ss = i; sort(tasks + 1, tasks + m + 1); int l = 1, r = m + 1; while(l < r){ int mid = (l + r) / 2; if(check(mid)) r = mid; else l = mid + 1; } cout << r << '\n'; int pos = 1; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= r && pos <= m && tasks[pos].ff <= i; ++j, ++pos) cout << tasks[pos].ss << ' '; cout << 0 << '\n'; } }[i].ss = i; sort(tasks + 1, tasks + m + 1); int l = 1, r = m + 1; while(l < r){ int mid = (l + r) / 2; if(check(mid)) r = mid; else l = mid + 1; } cout << r << '\n'; int pos = 1; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= r && pos <= m && tasks[pos].ff <= i; ++j, ++pos) cout << tasks[pos].ss << ' '; cout << 0 << '\n'; } }

Compilation message (stderr)

jobs.cpp:19:50: error: stray '#' in program
   19 |  for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, #include <bits/stdc++.h>
      |                                                  ^
jobs.cpp: In function 'int main()':
jobs.cpp:19:51: error: 'include' was not declared in this scope
   19 |  for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, #include <bits/stdc++.h>
      |                                                   ^~~~~~~
jobs.cpp:19:60: error: 'bits' was not declared in this scope
   19 |  for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, #include <bits/stdc++.h>
      |                                                            ^~~~
jobs.cpp:19:65: error: 'stdc' was not declared in this scope; did you mean 'std'?
   19 |  for(int i = 1; i <= m; ++i) cin >> tasks[i].ff, #include <bits/stdc++.h>
      |                                                                 ^~~~
      |                                                                 std
jobs.cpp:20:1: error: expected primary-expression before 'using'
   20 | using namespace std;
      | ^~~~~
jobs.cpp:28:20: error: a function-definition is not allowed here before '{' token
   28 | bool check(int mid){
      |                    ^
jobs.cpp:35:11: error: a function-definition is not allowed here before '{' token
   35 | int main(){
      |           ^
jobs.cpp:51:3: error: 'i' was not declared in this scope
   51 | }[i].ss = i;
      |   ^
jobs.cpp: In lambda function:
jobs.cpp:51:5: error: expected '{' before '.' token
   51 | }[i].ss = i;
      |     ^
jobs.cpp: In function 'int main()':
jobs.cpp:23:12: error: 'struct main()::<lambda()>' has no member named 'second'
   23 | #define ss second
      |            ^~~~~~
jobs.cpp:51:6: note: in expansion of macro 'ss'
   51 | }[i].ss = i;
      |      ^~
jobs.cpp:25:8: warning: unused variable 'd' [-Wunused-variable]
   25 | int n, d, m;
      |        ^