Submission #275010

# Submission time Handle Problem Language Result Execution time Memory
275010 2020-08-20T03:56:32 Z khangal Arranging Shoes (IOI19_shoes) C++14
0 / 100
112 ms 118008 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];
ll dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
vector<int>vec;
ll subtask3(vector<int> vv){
    ll res=0;
    for(ll i=0;i<vv.size();i+=2){
        if(vec[vv[i]]<0){
            res+=abs(vv[i+1]-vv[i]-1);
        }
        else{
            res+=abs(vv[i+1]-vv[i]);
        }
    }
    return res;
}
ll count_swaps(vector<int> vec){
    n=vec.size();
    map<int,vector<int>> mp;
    for(ll i=0;i<vec.size();i++){
        mp[abs(vec[i])].pb(i);
    }
    for(auto u:mp){
        ans+=subtask3(u.ss);
    }
    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 subtask3(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<vv.size();i+=2){
      |                ~^~~~~~~~~~
shoes.cpp: In function 'll count_swaps(std::vector<int>)':
shoes.cpp:57: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]
   57 |     for(ll i=0;i<vec.size();i++){
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 118008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 118008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 118008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 110 ms 117916 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 118008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 118008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -