Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
add wa-multiset solution
Browse files Browse the repository at this point in the history
  • Loading branch information
a01sa01to committed Aug 1, 2024
1 parent 8fbcd3f commit 9fc7075
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
7 changes: 5 additions & 2 deletions three-coins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ A_1 A_2 ... A_N
重複を削除すると高々 $\log N$ 種類しかないので、あとは全探索。

- `sol-cpp-ac`: C++ AC
- `sol-py-ac`: Python AC
- `sol-cpy-ac`: CPython AC
- `sol-pypy-ac`: PyPy AC
- `sol-cpp-partial1`: C++ 部分点 1
- `sol-py-partial1`: Python 部分点 1
- `sol-cpy-partial1`: CPython 部分点 1
- `sol-pypy-partial1`: PyPy 部分点 1
- `sol-cpp-wa-multiset`: C++ WA (集合 $S$ を多重集合としている)
3 changes: 3 additions & 0 deletions three-coins/sol-cpp-wa-multiset/SOLUTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8; mode: python -*-
cxx_solution(src='main.cc', flags=["-std=c++2a", "-O2"], challenge_cases=["*_task1.in", "*_all.in"])
expected_score(0)
21 changes: 21 additions & 0 deletions three-coins/sol-cpp-wa-multiset/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
a.erase(unique(a.begin(), a.end()), a.end());
multiset<ll> s;
assert(a.size() <= 100);
rep(i, a.size()) rep(j, a.size()) rep(k, a.size()) {
s.insert(a[i] + a[j] + a[k]);
}
ll ans = 0;
for (ll x : s) ans ^= x;
cout << ans << endl;
return 0;
}

0 comments on commit 9fc7075

Please sign in to comment.