184672025-10-23 15:06:28ubormaciSzerencsés számokcpp17Wrong answer 0/1002ms520 KiB
#include <iostream>
#include <algorithm> // for sort, mainly
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <array>
#include <string>
#include <cstdio>
#include <iterator>
#include <unordered_set>
#include <cstdint> // for int64_t, int32_t, etc
#include <queue>
#include <stack>
#include <deque>
#include <numeric> // gcd, lcm
#include <fstream>
#include <bitset> // for bitset
#include <iomanip>
#include <cassert> // for set with custom ordering
#include <type_traits> // for set with custom ordering
#include <utility> // for swap, forward, etc
using namespace std;

#pragma GCC optimize("O2")
// #pragma GCC optimize("O1","O2","O3","Ofast","unroll-loops")
// #pragma GCC target("sse","sse2","sse3","sse4.1","sse4.2","avx","avx2","fma")

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

/*

notes:

int64_t
stoi(string s) -> string to int
to_string() -> int (or else) to string

vector declaration:
vector<ll> v(n, 0)
vector<vector<ll>> v(n, vector<ll>(n, 0));

{if statement} ? {truth value} : {false value}

#ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif

std::lcm(ll a, ll b), std::gcd(int a, int b)

cout << fixed << setprecision(n);

set with custom ordering
set<ll, decltype(&cmp)> qu(cmp);

*/

typedef int64_t ll;

void solve() {

	vector<ll> v(3, 0);
	for(ll i = 0; i <= 9; i++) {
		ll tmp;
		cin >> tmp;
		if(i == 0) {
			continue;
		}
		v[i % 3] += tmp;
	}

	//cerr << "\nv=" << v;

	ll fin = v[0]; // tehat minden ami oszthato harommal azt direkt leirjuk, onmagaban
	v[0] = 0;
	fin += min(v[1], v[2]); // egy 3mod1-et osszerakhatunk egy 3mod2-vel
	
	if(v[1] < v[2]) {
		v[2] -= v[1];
		v[1] = 0;
	}
	else if(v[2] < v[1]) {
		v[1] -= v[2];
		v[2] = 0;
	}

	//cerr << "\nv=" << v;
	//cerr << "\nfin=" << fin;

	// 3mod1-bol 3 kell
	// 3mod2-bol 3 kell

	fin += (v[1] / 3) + (v[2] / 3);

	cout << fin;

}

int main()
{
	std::ios_base::sync_with_stdio(false);
	//cin.tie(nullptr);
	//cout.tie(nullptr);

	solve();

	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms316 KiB
3Wrong answer1ms316 KiB
subtask20/12
4Accepted1ms316 KiB
5Wrong answer1ms316 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms316 KiB
8Accepted1ms316 KiB
9Wrong answer1ms316 KiB
subtask30/10
10Wrong answer1ms316 KiB
11Wrong answer1ms316 KiB
12Wrong answer1ms500 KiB
13Wrong answer1ms508 KiB
14Wrong answer1ms316 KiB
subtask40/44
15Wrong answer2ms316 KiB
16Wrong answer1ms316 KiB
17Wrong answer1ms508 KiB
18Wrong answer1ms316 KiB
19Wrong answer2ms316 KiB
20Wrong answer1ms500 KiB
21Wrong answer1ms316 KiB
22Wrong answer1ms320 KiB
23Wrong answer1ms316 KiB
24Wrong answer1ms316 KiB
25Wrong answer1ms316 KiB
26Wrong answer1ms500 KiB
27Wrong answer1ms508 KiB
28Wrong answer1ms316 KiB
29Wrong answer1ms316 KiB
30Wrong answer1ms520 KiB
31Wrong answer1ms316 KiB
32Wrong answer1ms508 KiB
33Wrong answer1ms316 KiB
34Wrong answer1ms388 KiB
35Wrong answer1ms332 KiB
36Wrong answer1ms316 KiB
subtask50/34
37Wrong answer1ms500 KiB
38Wrong answer1ms316 KiB
39Wrong answer1ms500 KiB
40Wrong answer1ms508 KiB
41Wrong answer1ms316 KiB
42Wrong answer1ms316 KiB
43Wrong answer1ms508 KiB
44Wrong answer1ms320 KiB
45Wrong answer1ms316 KiB
46Wrong answer1ms316 KiB
47Wrong answer1ms500 KiB
48Wrong answer1ms316 KiB
49Wrong answer1ms316 KiB
50Wrong answer1ms328 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms316 KiB
53Wrong answer1ms316 KiB