# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
980371 | sleepntsheep | Painting Walls (APIO20_paint) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "paint.h"
#include<stdlib.h>
#include <vector>
/*
*
*
*
*
*/
#define NN 100000
#define MM 50000
#define KK 100000
void push(int**eh,int*eo,int i,int j)
{
int o=eo[i]++;
if(!o)eh[i]=(int*)malloc(2*sizeof**eh);
else if(!(o&o-1))eh[i]=(int*)realloc(eh[i],2*o*sizeof**eh);
eh[i][o]=j;
}
int*eh[MM], eo[MM];
int*fh[KK],fo[KK];
int freq[NN];
int minimumInstructions(
int N, int M, int K, std::vector<int> C,
std::vector<int> A, std::vector<std::vector<int>> B) {
for(int i=0;i<N;++i)push(fh,fo,C[i],i);
for(int i=0;i<M;++i)
for(int j=0;j<A[i];++j)
for(int k=0;k<fo[B[i][j]];++j)
if(!freq[fh[B[i][j]][k]]++)
push(eh,eo,i,fh[B[i][j]][k]); // should not push more than O(400000)
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |