Submission #473144

# Submission time Handle Problem Language Result Execution time Memory
473144 2021-09-15T09:03:18 Z Mr_Ph Doktor (COCI17_doktor) C++14
30 / 100
1000 ms 4288 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
void solve()
{
    int n;
    cin>>n;
    vi arr(n);
    ent(arr);
    ll a=0,b=0;
    int mx=0;
    for(int i=0; i<n; i++)
    {
        for(int k=i; k<n; k++)
        {
            vi temp=arr;
            reverse(temp.begin()+i,temp.begin()+k+1);
            int cnt=0;
            for(int e=1; e<=n; e++)
                if(temp[e-1]==e)
                    cnt++;
            if(cnt>mx)
            {
                mx=cnt;
                a=arr[i];
                b=arr[k];
            }
        }
    }
    cout<<a<<" "<<b;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    //cin>>t;//cin>>st;
    while(t--)
        solve();
}

Compilation message

doktor.cpp: In function 'void solve()':
doktor.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
      |                              ~^~~~~~~~~~~
doktor.cpp:28:5: note: in expansion of macro 'ent'
   28 |     ent(arr);
      |     ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 204 KB Output is correct
2 Correct 49 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 1260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 4288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 2784 KB Time limit exceeded
2 Halted 0 ms 0 KB -