# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
409639 | 2021-05-21T08:57:03 Z | juggernaut | Fireworks (APIO16_fireworks) | C++17 | 6 ms | 7340 KB |
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} typedef long long ll; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef IOI2021SG #define printl(args...)printf(args) #else #define printl(args...)((void)0) #endif vector<pair<int,int>>g[300005]; int main(){ int n,m; scanf("%d%d",&n,&m); vector<int>v; for(int i=2;i<=n+m;i++){ int x,y; scanf("%d%d",&x,&y); v.push_back(y); } ll ans=9e18; for(int x:v){ ll cnt=0; for(int y:v)cnt+=abs(x-y); umin(ans,cnt); } printf("%lld",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 7244 KB | Output is correct |
2 | Correct | 5 ms | 7244 KB | Output is correct |
3 | Correct | 6 ms | 7244 KB | Output is correct |
4 | Correct | 5 ms | 7244 KB | Output is correct |
5 | Correct | 5 ms | 7296 KB | Output is correct |
6 | Correct | 5 ms | 7244 KB | Output is correct |
7 | Correct | 5 ms | 7340 KB | Output is correct |
8 | Correct | 5 ms | 7244 KB | Output is correct |
9 | Correct | 6 ms | 7340 KB | Output is correct |
10 | Correct | 6 ms | 7252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 7244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 7244 KB | Output is correct |
2 | Correct | 5 ms | 7244 KB | Output is correct |
3 | Correct | 6 ms | 7244 KB | Output is correct |
4 | Correct | 5 ms | 7244 KB | Output is correct |
5 | Correct | 5 ms | 7296 KB | Output is correct |
6 | Correct | 5 ms | 7244 KB | Output is correct |
7 | Correct | 5 ms | 7340 KB | Output is correct |
8 | Correct | 5 ms | 7244 KB | Output is correct |
9 | Correct | 6 ms | 7340 KB | Output is correct |
10 | Correct | 6 ms | 7252 KB | Output is correct |
11 | Incorrect | 4 ms | 7244 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 7244 KB | Output is correct |
2 | Correct | 5 ms | 7244 KB | Output is correct |
3 | Correct | 6 ms | 7244 KB | Output is correct |
4 | Correct | 5 ms | 7244 KB | Output is correct |
5 | Correct | 5 ms | 7296 KB | Output is correct |
6 | Correct | 5 ms | 7244 KB | Output is correct |
7 | Correct | 5 ms | 7340 KB | Output is correct |
8 | Correct | 5 ms | 7244 KB | Output is correct |
9 | Correct | 6 ms | 7340 KB | Output is correct |
10 | Correct | 6 ms | 7252 KB | Output is correct |
11 | Incorrect | 4 ms | 7244 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |