제출 #502233

#제출 시각아이디문제언어결과실행 시간메모리
502233vrohakXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
void solve(int n) { int rj1[n + 65], l1, l2, l3, stg1 = 0, flg=0; rj1[1] = 0; int odg1 = query(1, 2); l1 = odg1; int odg2 = query(2, 3); l2 = odg2; int odg3 = query(1, 3); l3 = odg3; rj1[2] = odg1; if (odg3 == odg2 + odg1) { rj1[3] = odg1 + odg2; } else { stg1 = 1; rj1[3] = odg1 - odg2; } int od1[n + 65], od2[n + 56], od3[n + 99]; for (int i = 4; i < n + 1; i++) { odg1 = odg2; odg2 = query(i - 1, i); odg3 = query(i - 2, i); od1[i] = odg1; od2[i] = odg2; od3[i] = odg3; if (stg1 == 0) { if (odg3 == odg2 + odg1) { rj1[i] = rj1[i - 1] + odg2; } else { stg1 = 1; rj1[i] = rj1[i - 1] - odg2; } } else { if (odg3 == odg2 + odg1) { rj1[i] = rj1[i - 1] - odg2; } else { stg1 = 0; rj1[i] = rj1[i - 1] + odg2; } } } for(int i=1;i<=n;i++) rj2[i]=-rj1[i]; int mini1 = 0x3f3f3f3f; for (int i = 1; i < n + 1; i++) { mini1 = min(mini1, rj1[i]); } mini1 = abs(mini1) + 1; // ovdje je krivo bilo for (int i = 1; i < n + 1; i++) { rj1[i] = rj1[i] + mini1; } mini1 = 0x3f3f3f3f; for (int i = 1; i < n + 1; i++) { mini1 = min(mini1, rj2[i]); } mini1 = abs(mini1) + 1; // ovdje je krivo bilo for (int i = 1; i < n + 1; i++) { rj2[i] = rj2[i] + mini1; } int idx1=-1, idx2=-1, mp1; for(int i=1;i<=n;i++){ if(rj1[i] == 1) idx1 = i; if(rj1[i] == n) idx2 = i; } if(idx1 > idx2) flg=1; if (flg==0) { for (int i = 1; i < n + 1; i++) { answer(i, rj1[i]); } } else { for (int i = 1; i < n + 1; i++) { answer(i, rj2[i]); } } return; }

컴파일 시 표준 에러 (stderr) 메시지

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:4:15: error: 'query' was not declared in this scope
    4 |    int odg1 = query(1, 2);
      |               ^~~~~
xylophone.cpp:44:24: error: 'rj2' was not declared in this scope; did you mean 'rj1'?
   44 |  for(int i=1;i<=n;i++) rj2[i]=-rj1[i];
      |                        ^~~
      |                        rj1
xylophone.cpp:48:15: error: 'min' was not declared in this scope; did you mean 'mini1'?
   48 |       mini1 = min(mini1, rj1[i]);
      |               ^~~
      |               mini1
xylophone.cpp:50:12: error: 'abs' was not declared in this scope
   50 |    mini1 = abs(mini1) + 1;  // ovdje je krivo bilo
      |            ^~~
xylophone.cpp:57:26: error: 'rj2' was not declared in this scope; did you mean 'rj1'?
   57 |       mini1 = min(mini1, rj2[i]);
      |                          ^~~
      |                          rj1
xylophone.cpp:57:15: error: 'min' was not declared in this scope; did you mean 'mini1'?
   57 |       mini1 = min(mini1, rj2[i]);
      |               ^~~
      |               mini1
xylophone.cpp:61:7: error: 'rj2' was not declared in this scope; did you mean 'rj1'?
   61 |       rj2[i] = rj2[i] + mini1;
      |       ^~~
      |       rj1
xylophone.cpp:75:10: error: 'answer' was not declared in this scope
   75 |          answer(i, rj1[i]);
      |          ^~~~~~
xylophone.cpp:79:20: error: 'rj2' was not declared in this scope; did you mean 'rj1'?
   79 |          answer(i, rj2[i]);
      |                    ^~~
      |                    rj1
xylophone.cpp:79:10: error: 'answer' was not declared in this scope
   79 |          answer(i, rj2[i]);
      |          ^~~~~~
xylophone.cpp:64:24: warning: unused variable 'mp1' [-Wunused-variable]
   64 |  int idx1=-1, idx2=-1, mp1;
      |                        ^~~