Submission #230780

#TimeUsernameProblemLanguageResultExecution timeMemory
230780Dilshod_ImomovParrots (IOI11_parrots)C++17
52 / 100
12 ms1536 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { for ( int i = 0; i < N; i++ ) { vector < int > vc; int x = M[i]; for ( int i = 0; i < 3; i++ ) { vc.push_back( x % 10 ); x /= 10; } send( i * 10 + vc[0] ); send( i * 10 + vc[1] ); send( i * 10 + vc[1] ); for ( int j = 0; j < 4; j++ ) { send( i * 10 + vc[2] ); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { vector < int > vc[N]; for ( int i = 0; i < L; i++ ) { int x = X[i] / 10; vc[x].push_back( X[i] % 10 ); } for ( int i = 0; i < N; i++ ) { vector < int > cnt(10); for ( auto j: vc[i] ) { cnt[j]++; } vector < pair < int, int > > v; for ( int j = 0; j < 10; j++ ) { if ( cnt[j] ) { v.push_back( { j, cnt[j] } ); } } vector < int > digits(3); // cout << i << '\n'; for ( auto j: v ) { // cout << j.first << " " << j.second << '\n'; int x = j.first, y = j.second; if ( y == 1 ) { digits[2] = x; } else if ( y == 2 ) { digits[1] = x; } else if ( y == 4 ) { digits[0] = x; } else if ( y == 3 ) { digits[1] = digits[2] = x; } else if ( y == 6 ) { digits[0] = digits[1] = x; } else if ( y == 5 ) { digits[0] = digits[2] = x; } else if ( y == 7 ) { digits[0] = digits[1] = digits[2] = x; } } int ans = 0; ans += digits[0]; ans *= 10; ans += digits[1]; ans *= 10; ans += digits[2]; output(ans); } }
#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...