Submission #564460

# Submission time Handle Problem Language Result Execution time Memory
564460 2022-05-19T09:18:42 Z Majid Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
0 / 100
1513 ms 24232 KB
#include<bits/stdc++.h>
using namespace std;
 
//Types
using ll = long long;
using db = double;
 
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
 
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

int encode(int n, int x, int y){
	
        string ans;
        int mx = 0, cnt = 0;
        
        while(x){
            
            ans = (char)(x%2+'0') + ans;
            x/=2;
        }
        
        for(int i = 0; i < sz(ans); i++){
            
            mx = max(mx, cnt);
            if(ans[i]=='1')cnt++;
            else{
                
                mx = max(mx, cnt);
                cnt = 0;
            }
        }
        
        mx = max(mx, cnt);
        
        return __builtin_popcount(x) + mx;
}
#include<bits/stdc++.h>
using namespace std;
 
//Types
using ll = long long;
using db = double;
 
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
 
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

int decode(int n, int q, int h){
	
    string ans;
    int mx = 0, cnt = 0;
    
    while(q){
        
        ans = (char)(q%2+'0') + ans;
        q/=2;
    }
    
    for(int i = 0; i < sz(ans); i++){
        
        mx = max(mx, cnt);
        if(ans[i]=='1')cnt++;
        else{
            
            mx = max(mx, cnt);
            cnt = 0;
        }
    }
    
    return (__builtin_popcount(q) + mx == h);

}
# Verdict Execution time Memory Grader output
1 Incorrect 1513 ms 24100 KB wrong answer
2 Incorrect 1475 ms 24232 KB wrong answer