제출 #919942

#제출 시각아이디문제언어결과실행 시간메모리
919942mariaclara앵무새 (IOI11_parrots)C++17
0 / 100
1 ms808 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { for(int i = 0; i < N; i++) { int t, a, b, c, cnt = 0; for(t = 0; t <= 7 and cnt < M[i]; t++){ for(a = 0; a <= t and cnt < M[i]; a++) { for(b = 0; a+b <= t and cnt < M[i]; b++) { for(c = 0; a+b+c <= t and cnt < M[i]; c++) { cnt++; } } } } t--; a--; b--; c--; for(int j = 1; j <= a; j++) send(4*i); for(int j = 1; j <= b; j++) send(4*i+1); for(int j = 1; j <= c; j++) send(4*i+2); for(int j = 1; j <= t-a-b-c; j++) send(4*i+3); } }
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { int qtd[256]; memset(qtd, 0, sizeof(qtd)); for(int i = 0; i < L; i++) qtd[X[i]]++; for(int i = 0; i < N; i++) { int a = qtd[4*i], b = qtd[4*i+1], c = qtd[4*i+2], t = a+b+c+qtd[4*i+3], cnt = 0; for(int t1 = 0; t1 <= 7 and cnt >= 0; t1++){ for(int a1 = 0; a1 <= t1 and cnt >= 0; a1++) { for(int b1 = 0; a1+b1 <= t1 and cnt >= 0; b1++) { for(int c1 = 0; a1+b1+c1 <= t1 and cnt >= 0; c1++) { cnt++; if(t1 != t or a1 != a or b1 != b or c1 != c) continue; output(cnt); cnt = -1; } } } } } }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:19:21: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     t--; a--; b--; c--;
      |                    ~^~
encoder.cpp:19:16: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     t--; a--; b--; c--;
      |               ~^~
encoder.cpp:19:11: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     t--; a--; b--; c--;
      |          ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...