Submission #597420

#TimeUsernameProblemLanguageResultExecution timeMemory
597420AryamanRtunjayJob Scheduling (CEOI12_jobs)C++17
Compilation error
0 ms0 KiB
#include <stdio.h>
#define maxN 100001

using namespace std;

struct Cell {
    int id; Cell* next;
};
Cell* Req[maxN];
int Cn[maxN], m, n, d;

bool Test(int k)
{
    int dd = 1, r = 0;
    for(int x = 1; x<=n; x++)
    {
        if(Cn[x] == 0) continue;
        if(dd<x-d) {dd=x-d; r=0;}
        dd+=(Cn[x] + r)/k;
        r = (Cn[x]+r%k);
        if(dd>x+1 || dd == x+1 && r>0) return false;
    }
    return true;
}

Compilation message (stderr)

jobs.cpp: In function 'bool Test(int)':
jobs.cpp:21:32: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   21 |         if(dd>x+1 || dd == x+1 && r>0) return false;
      |                      ~~~~~~~~~~^~~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status