Submission #274985

# Submission time Handle Problem Language Result Execution time Memory
274985 2020-08-20T03:23:26 Z khangal Arranging Shoes (IOI19_shoes) C++14
0 / 100
41 ms 58360 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define BOOST ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
#define read(x) scanf("%lld",&x);
#define print(x) printf("%lld ",x);
#define endl '\n';
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z,res,par[1234567],cnt,sz[1234567];
bool used[1234567];
vl v[1234567],vec1;
char s1[1234567],s[1234567],ss[1234567];
vector<pl> vp[1234567];
bool ok;
map<ll,ll> mp;
ll c1[2234][2234],c2[1234][1234];
char ch[2234][2234];
vl vec;
ll dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
ll count_swaps(vector<int> vec){
    n=vec.size();
    for(ll i=0;i<vec.size()-1;i++){
        ll tmp=i;
        ll j=i+1;
        while(vec[tmp]!=-vec[j])j++;
        cout<<j<<" "<<tmp<<'\n';
        if(vec[tmp]>=0){
            ans+=(j-tmp);
        }
        else{
            ans+=(j-tmp-1);
        }
        vec.erase(vec.begin()+j);
    }
    return ans;
}
// int main(){
//     cin>>n;
//     vector<int> vec(n);
//     for(auto &u:vec)cin>>u;
//     cout<<count_swaps(vec);
// }

Compilation message

shoes.cpp: In function 'll count_swaps(std::vector<int>)':
shoes.cpp:44:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(ll i=0;i<vec.size()-1;i++){
      |                ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 58360 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 58360 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 58360 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 58276 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 58360 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 58360 KB secret mismatch
2 Halted 0 ms 0 KB -