Submission #502207

#TimeUsernameProblemLanguageResultExecution timeMemory
502207vrohakXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "xylophone.h" //using namespace std; void solve (int n){ //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan //ako je x pozitivan int rj1[n + 65], l1, l2, l3, stg1 = 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; } } } 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; } //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan //ako je x negativan int rj2[n+65]; rj2[1]=0; int stg2 = 1; int odg11 = l1; int odg22 = l2; int odg33 = l3; rj2[2] = (-1)*odg11; if (odg33 == odg22 + odg11){ rj2[3] = odg11 + odg22; rj2[3]*=(-1); } else { stg2 = 0; rj2[3] = rj2[2] + odg22; } for (int i = 4; i < n+1; i++){ odg11 = od1[i]; odg22 = od2[i]; odg33 = od3[i]; if (stg2 == 0){ if (odg33 == odg22 + odg11){ rj2[i] = rj2[i - 1] + odg22; } else { stg2 = 1; rj2[i] = rj2[i - 1] - odg22; } } else { if (odg33 == odg22 + odg11){ rj2[i] = rj2[i - 1] - odg22; } else { stg2 = 0; rj2[i] = rj2[i - 1] + odg22; } } } int mini2 = 0x3f3f3f3f; for (int i = 1; i < n + 1; i++){ mini2 = min(mini2, rj2[i]); } mini2 = abs(mini2) + 1; // tu isto je krivo jer mini2 moze biti negativan for (int i = 1; i < n + 1; i++){ rj2[i] = rj2[i] + mini2; } // < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > < ispis > int mp1 = 0, mp2 = 0, pro = 0, niz[n + 55]; memset(niz, 0, sizeof niz); for (int i = 1; i < n + 1; i++){ if (rj1[i] == 1){ pro++; } if (rj1[i] == n and pro == 0){ mp1++; break; } } for (int i = 1; i < n + 1; i++){ niz[rj1[i]]++; } for (int i = 1; i < n + 1; i++){ if (niz[i] == 0){ mp2 = 1; } } if (mp1 == 0 and mp2 == 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; } /*int main (){ int n; cin>>n; solve(n); return 0; }*/

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:49:12: error: 'min' was not declared in this scope; did you mean 'mini1'?
   49 |    mini1 = min(mini1 , rj1[i]);
      |            ^~~
      |            mini1
xylophone.cpp:51:11: error: 'abs' was not declared in this scope
   51 |   mini1 = abs(mini1) + 1; // ovdje je krivo bilo
      |           ^~~
xylophone.cpp:92:12: error: 'min' was not declared in this scope; did you mean 'mini2'?
   92 |    mini2 = min(mini2, rj2[i]);
      |            ^~~
      |            mini2
xylophone.cpp:102:4: error: 'memset' was not declared in this scope
  102 |    memset(niz, 0, sizeof niz);
      |    ^~~~~~
xylophone.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "xylophone.h"
  +++ |+#include <cstring>
    2 |