-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst.cpp
More file actions
94 lines (78 loc) · 2.7 KB
/
first.cpp
File metadata and controls
94 lines (78 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma GCC optimize ("O3")
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <bitset>
using namespace std;
#define FOR(i,a,b) for (long i = (a); i < (b); i++)
#define FORR(i,a,b) for (long i = (b)-1; i >= (a); i--)
#define all(x) (x).begin(), (x).end()
#define MAX(cont) *max_element(all((cont)))
#define MIN(cont) *min_element(all((cont)))
#define ARGMAX(cont) max_element(all((cont))) - (cont).begin()
#define ARGMIN(cont) min_element(all((cont))) - (cont).begin()
#define MAXLONG 9223372036854775807L
#define MINLONG -9223372036854775808L
typedef pair<long, long> pll;
typedef vector<long> vl;
typedef vector<vector<long>> ml;
template<typename T>
using matrix = vector<vector<T>>;
template<class Container>
void printc(const Container &cont){
for (auto e: cont) cout << e << " "; cout << endl;
}
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH> void _dbg(const char *sdbg, const vector<TH> &vec){
cerr<<sdbg<<'=';
for (TH e: vec) cerr << e << " "; cerr << endl;
}
template<class TH> void _dbg(const char *sdbg, const vector<vector<TH>> &mat){
cerr<<sdbg<<'='<< endl;
for(vector<TH> vec: mat){for(TH e: vec) cerr << e << " "; cerr << endl;}
}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
while(*sdbg!=',')cerr<<*sdbg++;
cerr<<'='<<h<<','<<' '; _dbg(sdbg+1, a...);
}
#define print(...) _dbg(#__VA_ARGS__, __VA_ARGS__);
// Things to be aware of:
// reassigning containers, e.g. vl vec2 = vec makes a copy.
// get iterator pointer via &(*iter)
// use g++sane for debugging, it catches array out of bound shenanigans
// you can do an ultimate return with a try / catch block
// map is always ordered according to key
// always assume the worst :D use MAX and MIN for boundaries of long
// long a = 1; max(0,a); fails as max is on long and int
// for interactove problems write a function "query", which sends and reads at the same time
// Usually copies are inserted into containers or functions, pass by reference if needed
// Erasing in a container by iterator causes errors in g++6.3 e.g. list.erase(iter), use iter++ and account for increment
// Be aware of functions with mod returning negative remainders
// print(...) macro can slow down the program
long solve(long t){
long N,P;
cin >>N>>P;
vl vec(N);
long k;
FOR(n,0,N) {
cin >> k;
vec[n] = k % P;
}
cout << "Case #" << t+1 << ": " << -1 << endl;
return 0;
}
int main(){
long T;
cin >> T;
FOR(t,0,T) solve(t);
}