Submission #761169

#TimeUsernameProblemLanguageResultExecution timeMemory
761169fatemetmhrJousting tournament (IOI12_tournament)C++17
0 / 100
1073 ms1228 KiB
//  ~ Be Name Khoda ~  //

#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  5e5   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

vector <int> tmp, av;


int GetBestPosition(int n, int c, int r, int *k, int *s, int *e){

    int mx = 0, out = 0;
    for(int tt = 0; tt < n; tt++){
        av.clear();
        for(int i = 0; i < tt; i++)
            av.pb(k[i]);
        av.pb(r);
        for(int i = tt; i < n - 1; i++)
            av.pb(k[i]);
        int val = 0;
        for(int i = 0; i < c; i++){
            tmp.clear();
            for(int j = 0; j < s[i]; j++)
                tmp.pb(av[j]);
            int mx = 0;
            for(int j = s[i]; j <= e[i]; j++)
                mx = max(mx, av[j]);
            tmp.pb(mx);
            //cout << "hen? " << tt << ' ' << i << ' ' << s[i] << ' ' << e[i] << ' ' << mx << endl;
            if(mx == r)
                val++;
            for(int j = e[i]; j < av.size(); j++)
                tmp.pb(av[j]);
            tmp.clear();
            for(auto u : tmp)
                av.pb(u);
        }
        if(val > mx){
            mx = val;
            out = tt;
        }
        //cout << tt << ' ' << val << endl;
    }
    return out;
}

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:50:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             for(int j = e[i]; j < av.size(); j++)
      |                               ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...