Submission #332814

#TimeUsernameProblemLanguageResultExecution timeMemory
332814zipdang04Coin Collecting (JOI19_ho_t4)C++14
0 / 100
1 ms400 KiB
#include <bits/stdc++.h> using namespace std; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; */ typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef map<int, int> mii; typedef unordered_map<int, int> umii; typedef map<ll, ll> mll; typedef unordered_map<ll, ll> umll; /* struct Node { int node, len; Node() {node = len = 0;} Node(int node, int len) {this -> node = node, this -> len = len;} }; typedef vector<Node> vg; */ #define MAX 100001 #define MOD 1000000007 #define fi first #define se second #define pf push_front #define pb push_back #define FOR(type, i, a, b) for(type i = (a); i <= (b); i++) #define FORR(type, i, b, a) for(type i = (b); i >= (a); i--) #define testBit(n, bit) (((n) >> (bit)) & 1) #define flipBit(n, bit) ((n) ^ (1ll << (bit))) #define cntBit(n) __builtin_popcount(n) #define cntBitll(n) __builtin_popcountll(n) #define randomize mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count()); ll n, x[MAX], y[MAX]; ll cal(ll *arr, ll valQuan){ ll tmp = n / valQuan; ll ans = 0; FOR(int, i, 1, n){ ll pos = 1 + (i - 1) / tmp; ans += abs(arr[i] - pos); } return ans; } // 0 0 1 1 4 5 // 0 0 0 1 1 1 main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; n <<= 1; FOR(ll, i, 1, n) cin >> x[i] >> y[i]; sort(x + 1, x + 1 + n); sort(y + 1, y + 1 + n); cout << cal(x, n / 2) + cal(y, 2); }

Compilation message (stderr)

joi2019_ho_t4.cpp:62:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main()
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...