Submission #65127

#TimeUsernameProblemLanguageResultExecution timeMemory
65127boookArt Class (IOI13_artclass)C++14
7 / 100
180 ms9360 KiB
#include "artclass.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
// #define int long long
#define MAX 550
#define INF 0x3f3f3f3f

int n , m , r[MAX][MAX] , g[MAX][MAX] , b[MAX][MAX];
int solvead(){
    // cout << "1or4" << endl;
    vector<int> sol;
    REP(i , 0 , n) REP(j , 0 , m){
        sol.pb(r[i][j] + g[i][j] + b[i][j]);
    }
    sort(ALL(sol) , greater<int>());
    if(sol[sol.size() / 10] >= 500) return 1;
    else return 4;
}
int solvebc(){
    // cout << "2or3" << endl;
    vector<int> sol;
    REP(i , 0 , n) REP(j , 0 , m){
        sol.pb(g[i][j] - r[i][j] - b[i][j]);
    }
    sort(ALL(sol) , greater<int>());
    // cout << sol[0] << endl;
    // cout << sol[sol.size() / 4] << endl;
    // cout << sol.back() << endl;
    // cout << (sol[0] + sol.back()) / 2 << endl;
    // for(int i = 0 ; i < sol.size() ; i += 100) cout << sol[i] << " "; cout << endl;
    if(sol[sol.size() / 10] <= -50) return 3;
    else {
        // cout << "here" << endl;
        int tmp = rand() % 2;
        if(tmp == 1) return 2;
        else return 3;
    }
    // if(sol[sol.size() / 10] >= 500) return 2;
    // else return 2;
}
int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
    n = N , m = M;
    REP(i , 0 , n) REP(j , 0 , m) r[i][j] = R[i][j];
    REP(i , 0 , n) REP(j , 0 , m) g[i][j] = G[i][j];
    REP(i , 0 , n) REP(j , 0 , m) b[i][j] = B[i][j];

    srand(time(NULL));
    vector<int> sol;
    REP(i , 1 , n) REP(j , 1 , m){
        int val = 0;
        val += abs(r[i][j] - r[i - 1][j - 1]);
        val += abs(g[i][j] - g[i - 1][j - 1]);
        val += abs(b[i][j] - b[i - 1][j - 1]);
        sol.pb(val);
    }
    sort(ALL(sol));
    int ans;
    if(sol[sol.size() / 10] < 13)
         ans = solvead();
    else ans = solvebc(); 
    return ans;
    // cout << ans << endl;
    // DBGG("ans = " , ans);
    // int tmp = sol.size() / 13;

    // sol.erase(sol.begin() , sol.begin() + tmp);
    // REP(i , 0 , tmp) sol.pop_back();
    // int siz = min(20LL , (int)sol.size()) , all = sol.size();
    // REP(i , 0 , siz) cout << sol[i] << " "; cout << endl;
    // REP(i , 0 , siz) cout << sol[all - 1 - i] << " "; cout << endl;

    // int v1 = 0 , v2 = 0 , v3 = 0;
    // REP(i , 0 , n) REP(j , 0 , m){
    //  v1 += r[i][j] * r[i][j];
    //  v2 += g[i][j] * g[i][j];
    //  v3 += b[i][j] * b[i][j];
    // }
    // cout << v1 << endl;
    // cout << v2 << endl;
    // cout << v3 << endl;
    // DB4(v1 , v2 , v3 , "");
    return 0;
}
// #undef int
#Verdict Execution timeMemoryGrader output
Fetching results...