Submission #228057

#TimeUsernameProblemLanguageResultExecution timeMemory
228057tushar_2658Parrots (IOI11_parrots)C++14
34 / 100
12 ms1536 KiB
#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; int get(string s){ stringstream ss; ss << s; int x; ss >> x; return x; } void encode(int N, int M[]) { for(int i = 0; i < N; ++i){ int x = M[i]; ++x; string s; if(i < 9){ s += "2"; } s += to_string((i + 1)); s += to_string(x); send(get(s)); } }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; int get1(string s){ stringstream ss; ss << s; int x; ss >> x; return x; } void decode(int N, int L, int X[]) { vector<int> ans(L); for(int i = 0; i < L; ++i){ int x = X[i]; string s = to_string(x); string ss; if(s[0] != '2'){ ss += s[0]; } ss += s[1]; int idx = get1(ss) - 1; ss = ""; int id = 2; while(id < s.size()){ ss += s[id]; ++id; } ans[idx] = get1(ss) - 1; } for(int i = 0; i < L; ++i){ output(ans[i]); } }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(id < s.size()){
          ~~~^~~~~~~~~~
#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...