Submission #25370

#TimeUsernameProblemLanguageResultExecution timeMemory
25370gabrielsimoesPalembang Bridges (APIO15_bridge)C++14
0 / 100
0 ms2024 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; int main() { int m, n; scanf("%d %d", &m, &n); char a,c; ll b,d, ans0 = 0; vector<pll> v; for (int i = 0; i < n; i++) { scanf(" %c %lld %c %lld",&a, &b,&c, &d); if (d < b) swap(b,d); printf("%c %c %d %d\n", a, c,a,c); if (a == c) ans0 += d - b; else v.push_back(pll(b,d)), ans0++; } if (m == 1) { vector<ll> all; for (pll& p : v) all.push_back(p.first), all.push_back(p.second); sort(all.begin(), all.end()); ll x = all[all.size()/2 - 1]; for (ll y : all) ans0 += abs(y - x); printf("%lld\n", ans0); return 0; } }

Compilation message (stderr)

bridge.cpp: In function 'int main()':
bridge.cpp:10:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &m, &n);
                        ^
bridge.cpp:16:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c %lld %c %lld",&a, &b,&c, &d);
                                          ^
#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...