Submission #685271

#TimeUsernameProblemLanguageResultExecution timeMemory
685271thegamercoder19Arranging Shoes (IOI19_shoes)C++14
50 / 100
1093 ms31260 KiB
#include "shoes.h" #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define M_PI 3.14159265358979323846 #define FILER 0 using ll = long long; using ull = unsigned long long; using ld = long double; const ll MOD = pow(10, 9) + 7; const ll INFL = 0x3f3f3f3f3f3f3f3f; const ull INFUL = 0x3f3f3f3f3f3f3f3f; const ll INFT = 0x3f3f3f3f; const ull MAX = 1LL << 24; const ll MODD = 998244353; const double EPS = 1e-10; #define V vector #define pll pair<ll, ll> #define pull2 pair<ull,ull> #define MS multiset #define M map #define Q queue #define PQ priority_queue #define IOF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c) #define FORR(typ,i,a,b,c) for(typ i = a; i > b; i -= c) #define FORA(a,i) for(auto &i : a) #define all(v) v.begin(),v.end() #define sz(v) v.size() #define sorta(a) sort(all(a)) #define sortd(a) sort(all(a), greater<ll>()) #define setp(x) setprecision(x)<<fixed #define RET return #define log(a,b) log(b)/log(a) #define WH(s) while(s) #define WHI(t) WH(t--) #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define Yes cout<<"Yes"<<endl; #define No cout<<"No"<<endl; #define YESNO(s) cout << (s ? "YES" : "NO") << endl; #define YesNo(s) cout<<(s?"Yes":"No")<<endl; #define TYP 0 using namespace std; map<ll, set<ll>> h; map<ll, bool> d; long long count_swaps(std::vector<int> s) { ll n = s.size(), res = 0; FOR(ll, i, 0, n, 1)h[s[i]].insert(i); FOR(ll, i, 0, s.size(), 2) { ll j = -1; for (j = i + 1; j < s.size() && s[i] != -s[j]; j++); //j--; FORR(ll, k, j, i+1, 1) swap(s[k], s[k - 1]), res++; if (s[i] > 0) swap(s[i], s[i+1]), res++; } return res; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:26:43: 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]
   26 | #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
......
   52 |  FOR(ll, i, 0, s.size(), 2)
      |          ~~~~~~~~~~~~~~                    
shoes.cpp:52:2: note: in expansion of macro 'FOR'
   52 |  FOR(ll, i, 0, s.size(), 2)
      |  ^~~
shoes.cpp:56:21: 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]
   56 |   for (j = i + 1; j < s.size() && s[i] != -s[j]; j++);
      |                   ~~^~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...