2017-03-28から1日間の記事一覧

codeforces #406 B. Not Afraid

方針 各グループについて、絶対値が等しい正負の値のペアが存在するか探索。 ペアが存在するグループは少なくとも全員がtraitorというわけではない。 ペアが存在しない場合は、グループ全員がtraitorの可能性がある。 一つのグループでも、グループ全員がtra…

codeforces #406 A. The Monster

方針 法則性とか考えないで総当りでいけるっぽい #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = -1; for(int i=0;i<1000;i++) { bool flag = false; for(int</algorithm></vector></iostream>…

ABC D - Maximum Average Sets

#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <iomanip> typedef long long ll; using namespace std; int main() { int n, a, b; cin >> n >> a >> b; vector<ll> v(n); for(int i=0;i<n;i++) { cin >> v[i]; } sort(v.begin(), v.end(), greater<ll>()); int max_cnt = 0; int…</ll></n;i++)></ll></iomanip></algorithm></cmath></vector></iostream>