Submission #642201

#TimeUsernameProblemLanguageResultExecution timeMemory
642201tigarCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll max_weights(int N, int M, int* X, int* Y, int* W) { bool subtask1=true, subtask2=true, subtask3=true; for(int i=0; i<M; i++) { if(X[i]%2!=0)subtask1=false; if(X[i]>1)subtask2=false; if(Y[i]!=0)subtask3=false; } if(subtask1) { ll rez=0; for(int i=0; i<M; i++)rez+=W[i]; return rez; } if(subtask2) { ll s1=0, s0=0, m[N][2]; for(int i=0; i<M; i++) { if(X[i]==0)s0+=W[i]; else s1+=W[i]; m[Y[i]][X[i]]=W[i]; } for(int i=0; i<N; i++) { m[i][0]=m[max(i-1, 0)][0]+m[i][0]; m[i][1]=m[max(i-1, 0)][1]+m[i][1]; } if(N==2)return max(m[N-1][0], m[N-1][1]); ll rez=0; for(int i=0; i<N; i++) { rez=max(rez, m[i][0]+m[N-1][1]-m[i][0]); } return rez; } }

Compilation message (stderr)

fish.cpp: In function 'll max_weights(int, int, int*, int*, int*)':
fish.cpp:8:40: warning: variable 'subtask3' set but not used [-Wunused-but-set-variable]
    8 |     bool subtask1=true, subtask2=true, subtask3=true;
      |                                        ^~~~~~~~
fish.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
/usr/bin/ld: /tmp/ccQCgEyY.o: in function `main':
grader.cpp:(.text.startup+0x25e): undefined reference to `max_weights(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status