Submission #28589

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
285892017-07-16 07:44:11not good but never sad (#68)Test Data Creation (FXCUP2_testdata)C++98
0 / 1
0 ms952 KiB
#include <stdio.h>
int N, M, S[300*300][601], T[300*300];
bool wh[300*300][601], mv[300*300][601], ans[300*300];
void upd(int i, int k, int t, bool w, bool m)
{
if (S[i][k] == -1 || S[i][k] > t){
S[i][k] = t;
wh[i][k] = w;
mv[i][k] = m;
}
}
int main()
{
scanf("%d %d", &M, &N);
for (int i=0;i<N*M;i++) scanf("%d", &T[i]);
for (int i=0;i<N*M;i++) for (int k=0;k<=600;k++) S[i][k] = -1;
S[0][300] = T[0];
for (int i=0;i<N*M;i++){
int xp = i / M, yp = i % M;
for (int k=0;k<=600;k++) if (S[i][k] != -1){
if (k >= 300){
if (xp + 1 < N) upd(i+M,k-M,S[i][k]+(k-M!=300?T[i+M]:0),0,0);
if (yp + 1 < M) upd(i+1,k-1,S[i][k]+(k-1!=300?T[i+1]:0),0,1);
}
else{
int xq = (i + k - 300) / N, yq = (i + k - 300) % N;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

testdata.cpp: In function 'int main()':
testdata.cpp:17:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &M, &N);
                        ^
testdata.cpp:18:44: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0;i<N*M;i++) scanf("%d", &T[i]);
                                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...