-
Notifications
You must be signed in to change notification settings - Fork 0
/
prince_template.cpp
105 lines (75 loc) · 2 KB
/
prince_template.cpp
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
95
96
97
98
99
100
101
102
103
104
105
#include <iostream>
#include <vector>
// #include <algorithm>
// #include <math.h>
// #include <ctype.h>
// #include <set>
// #include <stack>
// #include <queue>
// #include <deque>
// #include <stdio.h>
// #include <stdlib.h>
// #include <string.h>
// #include <string>
//#include <utility> //for pair
// #define SORT(a, n) sort(begin(a), begin(a) + n) //nlogn sort
// int max= *max_element(v.begin(), v.end());
// #define MOD 1000000007
//Title: [CODE: ]
using namespace std;
int main() {
int T; //test cases
cin >> T;
vector<int> results;
for (int i = 1; i < T+1; i++) {
int N;
cin >> N;
//get the list of elements
vector<int> elements;
elements.clear();
for (int j = 0; j < N; j++){
int ele;
cin >> ele;
elements.push_back(ele);
}
//----write from here-----
} //for each test case
//print results
for (int i = 0; i < results.size(); i++){
cout << results[i] << endl;
}
return 0;
}
//
/*
cout<<"PRINT VECTOR: ";
for(int j=0; j<elements.size(); j++){
cout<<elements[j]<<" ";
}
cout<<endl;
//Position of element in a vector
vector<int>::iterator it;
it = find(elements.begin(), elements.end(), element);
int pos = distance(elements.begin(), it);
//Modulo rules
(a+b)%m = (a%m+b%m)%m.
(a*b)%m = (a%m*b%m)%m.
//convert array to vector
int arr[] = {5, 10, 15, 20, 20, 23, 42, 45};
int n = sizeof(arr)/sizeof(arr[0]);
vector<int> vect(arr, arr+n);
//HASH
map<int, vector<int> > hash;
hash[0].push_back(1);
hash[0].push_back(2);
hash[0].push_back(3);
//other
template<typename ForwardIterator, typename T>
ForwardIterator first_less_than (ForwardIterator first, ForwardIterator last, T value) {
auto it = std::lower_bound (first, last, value);
return (it == first ? last : --it);
}
auto it = first_less_than (v.begin (), v.end (), 3);
cout << (it != v.end () ? to_string (*it) : "Not Found") << endl; // outputs 1
cout << distance (v.begin (), it) << endl; // outputs 1
*/