-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.cpp
More file actions
68 lines (55 loc) · 1.39 KB
/
t1.cpp
File metadata and controls
68 lines (55 loc) · 1.39 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
#include <bits/stdc++.h>
#include <semaphore.h>
using namespace std;
using namespace chrono;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define nl "\n"
#define maxe(a) (*max_element(a.begin(), a.end()))
#define mine(a) (*min_element(a.begin(), a.end()))
#define all(a) a.begin(), a.end()
#define lsb(n) (n & -n)
#define msb(n) (1LL << (63 - __builtin_clzll(n)))
#define nsb(n) (__builtin_popcountll(n))
#define len(n) (to_string(n).size())
ll N = 1e8, num_t;
sem_t sem;
void work(ll tid) {
// ll s = 0;
// for(ll i=tid; i<N; i+=num_t) {
// s += i;
// }
}
void solve() {
int i;
cin >> num_t;
sem_init(&sem, 0, 1);
high_resolution_clock::time_point t1 = high_resolution_clock::now();
// vector<thread> th;
// for(i=0; i<num_t; i++) {
// th.push_back(thread(work, i));
// }
// for(i=0; i<num_t; i++) {
// th[i].join();
// }
int* arr = new int[N];
for(i=0; i<N/10; i++) {
arr[i] = i;
}
delete[] arr;
// num_t = 1;
// work(0);
high_resolution_clock::time_point t2 = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(t2 - t1).count();
cout << duration << nl;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
for (int i = 0; i < t; i++) {
solve();
}
return 0;
}