Submission #157717

#TimeUsernameProblemLanguageResultExecution timeMemory
157717a_playerJob Scheduling (CEOI12_jobs)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define se second using namespace std; int N,M,D; int s[1000001]; vector<int> st[100001]; bool check(int T){ if(T>=M)return true; if(T==0)return false; int j=0; for(int i=0;i<M;i++){ if(i%T==0)j++; j=max(j,s[i].f); if(s[i].f+D<j)return false; } return true; } int main(){ cin>>N>>D>>M; for(int i=0;i<M;i++){ cin>>s[i].f; s[i].se=i; } sort(s,s+M); int x=-1; for(int b=M;b>=1;b/=2) while(!check(x+b))x+=b; cout<<x+1<<endl; x++; int j=0; for(int i=0;i<M;i++){ if(i%x==0)j++; j=max(j,s[i].f); if(s[i].f+D<j)st[j].push_back(s[i].se); } for(int i=0;i<N;i++){ for(int z=0;z<st[i].size();z++)cout<<st[i][z]<<" "; cout<<0<<endl; } }

Compilation message (stderr)

jobs.cpp: In function 'bool check(int)':
jobs.cpp:2:11: error: request for member 'first' in 's[i]', which is of non-class type 'int'
 #define f first
           ^
jobs.cpp:16:20: note: in expansion of macro 'f'
       j=max(j,s[i].f);
                    ^
jobs.cpp:2:11: error: request for member 'first' in 's[i]', which is of non-class type 'int'
 #define f first
           ^
jobs.cpp:17:15: note: in expansion of macro 'f'
       if(s[i].f+D<j)return false;
               ^
jobs.cpp: In function 'int main()':
jobs.cpp:2:11: error: request for member 'first' in 's[i]', which is of non-class type 'int'
 #define f first
           ^
jobs.cpp:24:15: note: in expansion of macro 'f'
     cin>>s[i].f;
               ^
jobs.cpp:3:12: error: request for member 'second' in 's[i]', which is of non-class type 'int'
 #define se second
            ^
jobs.cpp:25:10: note: in expansion of macro 'se'
     s[i].se=i;
          ^~
jobs.cpp:2:11: error: request for member 'first' in 's[i]', which is of non-class type 'int'
 #define f first
           ^
jobs.cpp:37:20: note: in expansion of macro 'f'
       j=max(j,s[i].f);
                    ^
jobs.cpp:2:11: error: request for member 'first' in 's[i]', which is of non-class type 'int'
 #define f first
           ^
jobs.cpp:38:15: note: in expansion of macro 'f'
       if(s[i].f+D<j)st[j].push_back(s[i].se);
               ^
jobs.cpp:3:12: error: request for member 'second' in 's[i]', which is of non-class type 'int'
 #define se second
            ^
jobs.cpp:38:42: note: in expansion of macro 'se'
       if(s[i].f+D<j)st[j].push_back(s[i].se);
                                          ^~
jobs.cpp:41:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int z=0;z<st[i].size();z++)cout<<st[i][z]<<" ";
                 ~^~~~~~~~~~~~~