Submission #295903

#TimeUsernameProblemLanguageResultExecution timeMemory
295903GurbanWiring (IOI17_wiring)C++17
13 / 100
41 ms3840 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define ss second #define ff first #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() typedef long double ld; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; const ll inf = 1e18; const int mod = 1e9+7; //998244353; const int maxn = 1e5+5; const int Xg[4] = {1,0,-1,0}, Yg[4] = {0,1,0,-1}; ll modpw(ll a,ll e) {if(e==0)return 1;ll x=modpw(a*a%mod,e>>1);return e&1?x*a%mod:x;} ll min_total_length(vi r, vi b) { ll ans = 0; int now=0,now1=0; while(now < sz(r) and now1 < sz(b)){ ans += b[now]-r[now]; now++,now1++; } while(now < sz(r)) ans += (b.front()-r[now]),now++; while(now1 < sz(b)) ans += (b[now1]-r.back()),now1++; return ans; }
#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...