제출 #515609

#제출 시각아이디문제언어결과실행 시간메모리
515609Theo830Cat (info1cup19_cat)C++17
15 / 100
765 ms5392 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
int main(void){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        ll arr[n];
        vll a[2];
        ll posa = 0;
        vll b;
        f(i,0,n){
            cin>>arr[i];
            if(i < n/2 && arr[i] > n/2){
                posa++;
                b.pb(n + 1 - arr[i]);
            }
            arr[i] = min(arr[i],n + 1 - arr[i]);
            a[i >= n/2].pb(arr[i]);
        }
        reverse(all(a[1]));
        ll res = 0;
        f(i,0,a[0].size()){
            if(a[0][i] != i+1){
                res++;
            }
        }
        if(a[0] == a[1] && (posa % 2 == 0)){
            cout<<res / 2<<" ";
            cout<<"0\n";
        }
        else{
            cout<<"-1\n";
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

cat.cpp: In function 'int main()':
cat.cpp:8:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define f(i,a,b) for(ll i = a;i < b;i++)
......
   46 |         f(i,0,a[0].size()){
      |           ~~~~~~~~~~~~~~~        
cat.cpp:46:9: note: in expansion of macro 'f'
   46 |         f(i,0,a[0].size()){
      |         ^
#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...