Submission #18866

#TimeUsernameProblemLanguageResultExecution timeMemory
18866choyi0521라멘 (JOI14_ramen)C++14
100 / 100
0 ms1124 KiB
#include "ramen.h" bool a[400], b[400],flag; void query(int i,int j) { if (!a[i] && !a[j] || !b[i] && !b[j]) { flag = true; int c = Compare(i, j); if (c == 1) b[j] = a[i] = true; else b[i] = a[j] = true; } } void Ramen(int N) { for (int i = 1; i < N; i += 2) query(i - 1, i); do { flag = false; for (int i = 0; i < N - 1; i++) for (int j = i + 1; j < N; j++) query(i, j); } while (flag); int p1, p2; for (int i = 0; i < N; i++) { if (!a[i]) p1 = i; if (!b[i]) p2 = i; } Answer(p1, p2); }

Compilation message (stderr)

ramen.cpp: In function 'void query(int, int)':
ramen.cpp:4:12: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if (!a[i] && !a[j] || !b[i] && !b[j]) {
            ^
ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:24:16: warning: 'p2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  Answer(p1, p2);
                ^
ramen.cpp:24:16: warning: 'p1' may be used uninitialized in this function [-Wmaybe-uninitialized]

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...