Skip to content

Commit 05650cf

Browse files
committed
CF 884, got A
1 parent e4bb867 commit 05650cf

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

codeforces/884/A.cpp

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Author: Joshua Goller
2+
3+
// Website: https://jsgoller1.github.io
4+
5+
// Includes all standard headers (no need for <vector>, <list>, etc).
6+
#include <bits/stdc++.h>
7+
8+
using namespace std;
9+
10+
// --- I/O ---
11+
/*
12+
sync_with_stdio(): do not sync C++ streams (e.g. std::cin) with C streams
13+
(e.g. stdin) after each output; adds unnecessary time.
14+
15+
tie(): untie cin from cout (tied by default); if tied, each read from cin
16+
flushes cout, adds unnecessary time. Unclear from Stroustrup if both need to be
17+
untied, doing it to be safe.
18+
*/
19+
#define sanic_io() \
20+
ios_base::sync_with_stdio(false); \
21+
cin.tie(NULL); \
22+
cout.tie(NULL);
23+
#define endl "\n" // std::endl causes a flush, adds unnecessary time
24+
#define read_from_files(in_path, out_path) \
25+
freopen(in_path, "r", stdin); \
26+
freopen(out_path, "w", stdout);
27+
#define output(val) cout << val << endl;
28+
#define var_in(type, var) \
29+
type var; \
30+
cin >> var;
31+
#define iin(var) var_in(int, var)
32+
#define lin(var) var_in(ll, var)
33+
#define strin(var) var_in(string, var)
34+
35+
// --- Abbreviations --
36+
#define rep(i, n) for (int i = 0; i < (n); i++)
37+
#define rep1(i, n) for (int i = 1; i <= (n); i++)
38+
#define all(x) (x).begin(), (x).end()
39+
#define rall(x) (x).rbegin(), (x).rend() // reverse iterator
40+
#define fi first
41+
#define se second
42+
#define pb push_back
43+
#define eb emplace_back
44+
#define mp make_pair
45+
46+
// -- Types --
47+
typedef long long ll;
48+
typedef unsigned long long ull;
49+
typedef unsigned uint;
50+
typedef long double ld;
51+
typedef pair<int, int> pii;
52+
typedef pair<ll, ll> pll;
53+
typedef vector<int> vi;
54+
typedef vector<ll> vl;
55+
typedef vector<pii> vii;
56+
typedef vector<pll> vll;
57+
58+
// -- Testing --
59+
#ifdef LOCAL
60+
#define eprintf(...) \
61+
{ \
62+
fprintf(stderr, __VA_ARGS__); \
63+
fflush(stderr); \
64+
}
65+
66+
#else
67+
#define eprintf(...) 0
68+
#endif
69+
70+
clock_t start_time, case_time;
71+
double getCurrentTime() { return ((double)clock()) / CLOCKS_PER_SEC; }
72+
73+
static void solve() {
74+
lin(a);
75+
lin(b);
76+
output(a + b);
77+
// if 1 not in array, mex is smallest-1; if 1 in array, start from smallest
78+
// and add 1 til a missing found
79+
//
80+
}
81+
82+
int main() {
83+
sanic_io();
84+
// cout << setprecision(12);
85+
// read_from_files();
86+
lin(cases);
87+
88+
#ifdef LOCAL
89+
start_time = getCurrentTime();
90+
rep(i, cases) {
91+
case_time = getCurrentTime();
92+
solve();
93+
eprintf("Case %d: %f sec \n", i, getCurrentTime() - case_time);
94+
}
95+
eprintf("Total time: %f sec \n", getCurrentTime() - start_time);
96+
#else
97+
rep(i, cases) { solve(); }
98+
#endif
99+
100+
return 0;
101+
}

codeforces/884/A_input0.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3
2+
1 4
3+
1 5
4+
9 26

0 commit comments

Comments
 (0)