This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub crackersamdjam/Codebook
#define PROBLEM "https://atcoder.jp/contests/agc001/tasks/agc001_a" #include "../content/utils/template.h" int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n, l[200]; cin>>n; for(int i = 0; i < 2*n; i++) cin>>l[i]; sort(l, l+2*n); int ans = 0; for(int i = 0; i < 2*n; i += 2){ ans += l[i]; } cout<<ans<<'\n'; }
#line 1 "tests/atcoder.test.cpp" #define PROBLEM "https://atcoder.jp/contests/agc001/tasks/agc001_a" #line 1 "content/utils/template.h" /** * @brief My starter code */ #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define makeunique(x) (x).erase(unique((x).begin(), (x).end()), (x).end()); #ifdef LOCAL template<typename T> void pr(T a){std::cerr<<a<<std::endl;} template<typename T, typename... Args> void pr(T a, Args... args){std::cerr<<a<<' ',pr(args...);} #else template<typename... Args> void pr(Args... args){} #endif using namespace std; using ll = long long; using pii = pair<int, int>; #line 3 "tests/atcoder.test.cpp" int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n, l[200]; cin>>n; for(int i = 0; i < 2*n; i++) cin>>l[i]; sort(l, l+2*n); int ans = 0; for(int i = 0; i < 2*n; i += 2){ ans += l[i]; } cout<<ans<<'\n'; }