Skip to content

Commit ff08373

Browse files
committed
04 Oct, 2018
1 parent 8045da1 commit ff08373

File tree

11 files changed

+982
-2
lines changed

11 files changed

+982
-2
lines changed

Codeforces/AC/gym_100283.cpp

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/*
2+
* FILE: gym_100283.cpp
3+
*
4+
* @author: Arafat Hasan Jenin <opendoor.arafat[at]gmail[dot]com>
5+
*
6+
* LINK: https://codeforces.com/gym/100283/problem/E
7+
*
8+
* DATE CREATED: 20-09-18 15:35:38 (+06)
9+
* LAST MODIFIED: 20-09-18 16:47:01 (+06)
10+
*
11+
* VERDICT: Accepetd
12+
*
13+
* DEVELOPMENT HISTORY:
14+
* Date Version Description
15+
* --------------------------------------------------------------------
16+
* 20-09-18 1.0 Deleted code is debugged code.
17+
*
18+
* _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
19+
* _/ _/ _/_/ _/ _/ _/_/ _/
20+
* _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/
21+
* _/ _/ _/ _/ _/_/ _/ _/ _/_/
22+
* _/_/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
23+
*/
24+
25+
///////////////////////////////////////////////////////////////////////
26+
27+
#include <iostream>
28+
#include <climits>
29+
#include <cmath>
30+
#include <cstring>
31+
#include <cctype>
32+
#include <cstdio>
33+
#include <cstdlib>
34+
#include <iomanip>
35+
#include <utility>
36+
#include <sstream>
37+
#include <algorithm>
38+
#include <stack>
39+
#include <set>
40+
#include <list>
41+
#include <map>
42+
#include <unordered_map>
43+
#include <unordered_set>
44+
#include <queue>
45+
#include <deque>
46+
#include <vector>
47+
#include <tuple>
48+
#include <stdint.h> //uint32_t
49+
#include <functional>
50+
#include <bitset>
51+
#include <unistd.h> // unsigned int sleep(unsigned int seconds);
52+
53+
using namespace std;
54+
55+
typedef long long ll;
56+
typedef double lf;
57+
typedef long double llf;
58+
typedef unsigned long long ull;
59+
typedef pair<int, int> pii;
60+
typedef vector<pii> vpii;
61+
typedef vector<int> vi;
62+
typedef vector<long long> vl;
63+
64+
#define _USE_MATH_DEFINES
65+
66+
#define _FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
67+
68+
#define forr(i, a, b) for (__typeof (a) i = (a); i <= (b); i++)
69+
#define rof(i, b, a) for (__typeof (a) i = (b); i >= (a); i--)
70+
#define rep(i, n) for (__typeof (n) i = 0; i < (n); i++)
71+
#define forit(i, s) for (__typeof ((s).end()) i = (s).begin(); i != (s).end(); ++i)
72+
#define all(ar) ar.begin(), ar.end()
73+
#define fill(a, val) memset((a), (val), sizeof((a)))
74+
#define clr(a) memset((a), 0, sizeof((a)))
75+
#define sz(a) (int) a.size()
76+
77+
#define pb push_back
78+
79+
#ifndef ONLINE_JUDGE
80+
#define nl cerr << '\n'
81+
#define sp cerr << ' '
82+
#define ckk cerr << "###############\n"
83+
#define debug1(x) cerr << #x << ": " << (x) << '\n'
84+
#define debug2(x, y) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\n'
85+
#define debug3(x, y, z) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\t' << #z << ": " << (z) << '\n'
86+
#else
87+
#define nl
88+
#define sp
89+
#define ckk
90+
#define debug1(x)
91+
#define debug2(x, y)
92+
#define debug3(x, y, z)
93+
#endif
94+
95+
#define PI acos(-1.0)
96+
#define INF 0x7fffffff
97+
#define MOD 1000000007
98+
#define EPS 1e-7
99+
#define MAX 10000007 //1e7+7
100+
101+
////////////////////////// START HERE //////////////////////////
102+
103+
int main() {
104+
_FastIO;
105+
freopen ("ghanophobia.in", "r", stdin);
106+
int n, cs = 0, ghana, egypt;
107+
cin >> n;
108+
109+
while (n--) {
110+
cin >> egypt; cin.ignore(); cin >> ghana;
111+
cout << "Case " << ++cs << ": ";
112+
113+
if (ghana + 6 == egypt + 1) {
114+
egypt = egypt + 2;
115+
ghana = ghana * 2 + 6;
116+
cout << (ghana == egypt ? "PENALTIES" : (ghana < egypt ? "YES" : "NO") );
117+
118+
} else if (ghana + 6 < egypt + 1) {
119+
cout << "YES";
120+
121+
} else {
122+
cout << "NO";
123+
}
124+
125+
cout << endl;
126+
}
127+
128+
return 0;
129+
}

Contests/Codeforces/1058/1058A.cpp

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
* FILE: 1058A.cpp
3+
*
4+
* @author: Arafat Hasan Jenin <opendoor.arafat[at]gmail[dot]com>
5+
*
6+
* LINK:
7+
*
8+
* DATE CREATED: 23-09-18 19:06:03 (+06)
9+
* LAST MODIFIED: 23-09-18 19:08:43 (+06)
10+
*
11+
* VERDICT: Accepted
12+
*
13+
* DEVELOPMENT HISTORY:
14+
* Date Version Description
15+
* --------------------------------------------------------------------
16+
* 23-09-18 1.0 Deleted code is debugged code.
17+
*
18+
* _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
19+
* _/ _/ _/_/ _/ _/ _/_/ _/
20+
* _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/
21+
* _/ _/ _/ _/ _/_/ _/ _/ _/_/
22+
* _/_/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
23+
*/
24+
25+
///////////////////////////////////////////////////////////////////////
26+
27+
#include <iostream>
28+
#include <climits>
29+
#include <cmath>
30+
#include <cstring>
31+
#include <cctype>
32+
#include <cstdio>
33+
#include <cstdlib>
34+
#include <iomanip>
35+
#include <utility>
36+
#include <sstream>
37+
#include <algorithm>
38+
#include <stack>
39+
#include <set>
40+
#include <list>
41+
#include <map>
42+
#include <unordered_map>
43+
#include <unordered_set>
44+
#include <queue>
45+
#include <deque>
46+
#include <vector>
47+
#include <tuple>
48+
#include <stdint.h> //uint32_t
49+
#include <functional>
50+
#include <bitset>
51+
#include <unistd.h> // unsigned int sleep(unsigned int seconds);
52+
53+
using namespace std;
54+
55+
typedef long long ll;
56+
typedef double lf;
57+
typedef long double llf;
58+
typedef unsigned long long ull;
59+
typedef pair<int, int> pii;
60+
typedef vector<pii> vpii;
61+
typedef vector<int> vi;
62+
typedef vector<long long> vl;
63+
64+
#define _USE_MATH_DEFINES
65+
66+
#define _FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
67+
68+
#define forr(i, a, b) for (__typeof (a) i = (a); i <= (b); i++)
69+
#define rof(i, b, a) for (__typeof (a) i = (b); i >= (a); i--)
70+
#define rep(i, n) for (__typeof (n) i = 0; i < (n); i++)
71+
#define forit(i, s) for (__typeof ((s).end()) i = (s).begin(); i != (s).end(); ++i)
72+
#define all(ar) ar.begin(), ar.end()
73+
#define fill(a, val) memset((a), (val), sizeof((a)))
74+
#define clr(a) memset((a), 0, sizeof((a)))
75+
#define sz(a) (int) a.size()
76+
77+
#define pb push_back
78+
79+
#ifndef ONLINE_JUDGE
80+
#define nl cerr << '\n'
81+
#define sp cerr << ' '
82+
#define ckk cerr << "###############\n"
83+
#define debug1(x) cerr << #x << ": " << (x) << '\n'
84+
#define debug2(x, y) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\n'
85+
#define debug3(x, y, z) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\t' << #z << ": " << (z) << '\n'
86+
#else
87+
#define nl
88+
#define sp
89+
#define ckk
90+
#define debug1(x)
91+
#define debug2(x, y)
92+
#define debug3(x, y, z)
93+
#endif
94+
95+
#define PI acos(-1.0)
96+
#define INF 0x7fffffff
97+
#define MOD 1000000007
98+
#define EPS 1e-7
99+
#define MAX 10000007 //1e7+7
100+
101+
////////////////////////// START HERE //////////////////////////
102+
103+
int main() {
104+
_FastIO;
105+
int n, tmp;
106+
cin >> n;
107+
108+
while (n--) {
109+
cin >> tmp;
110+
111+
if (tmp == 1) {
112+
cout << "HARD\n";
113+
return 0;
114+
}
115+
}
116+
117+
cout << "EASY\n";
118+
return 0;
119+
}
120+

Contests/Codeforces/1058/1058B.cpp

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* FILE: 1058B.cpp
3+
*
4+
* @author: Arafat Hasan Jenin <opendoor.arafat[at]gmail[dot]com>
5+
*
6+
* LINK:
7+
*
8+
* DATE CREATED: 23-09-18 19:15:50 (+06)
9+
* LAST MODIFIED: 23-09-18 19:21:14 (+06)
10+
*
11+
* VERDICT:
12+
*
13+
* DEVELOPMENT HISTORY:
14+
* Date Version Description
15+
* --------------------------------------------------------------------
16+
* 23-09-18 1.0 Deleted code is debugged code.
17+
*
18+
* _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
19+
* _/ _/ _/_/ _/ _/ _/_/ _/
20+
* _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/
21+
* _/ _/ _/ _/ _/_/ _/ _/ _/_/
22+
* _/_/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
23+
*/
24+
25+
///////////////////////////////////////////////////////////////////////
26+
27+
#include <iostream>
28+
#include <climits>
29+
#include <cmath>
30+
#include <cstring>
31+
#include <cctype>
32+
#include <cstdio>
33+
#include <cstdlib>
34+
#include <iomanip>
35+
#include <utility>
36+
#include <sstream>
37+
#include <algorithm>
38+
#include <stack>
39+
#include <set>
40+
#include <list>
41+
#include <map>
42+
#include <unordered_map>
43+
#include <unordered_set>
44+
#include <queue>
45+
#include <deque>
46+
#include <vector>
47+
#include <tuple>
48+
#include <stdint.h> //uint32_t
49+
#include <functional>
50+
#include <bitset>
51+
#include <unistd.h> // unsigned int sleep(unsigned int seconds);
52+
53+
using namespace std;
54+
55+
typedef long long ll;
56+
typedef double lf;
57+
typedef long double llf;
58+
typedef unsigned long long ull;
59+
typedef pair<int, int> pii;
60+
typedef vector<pii> vpii;
61+
typedef vector<int> vi;
62+
typedef vector<long long> vl;
63+
64+
#define _USE_MATH_DEFINES
65+
66+
#define _FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
67+
68+
#define forr(i, a, b) for (__typeof (a) i = (a); i <= (b); i++)
69+
#define rof(i, b, a) for (__typeof (a) i = (b); i >= (a); i--)
70+
#define rep(i, n) for (__typeof (n) i = 0; i < (n); i++)
71+
#define forit(i, s) for (__typeof ((s).end()) i = (s).begin(); i != (s).end(); ++i)
72+
#define all(ar) ar.begin(), ar.end()
73+
#define fill(a, val) memset((a), (val), sizeof((a)))
74+
#define clr(a) memset((a), 0, sizeof((a)))
75+
#define sz(a) (int) a.size()
76+
77+
#define pb push_back
78+
79+
#ifndef ONLINE_JUDGE
80+
#define nl cerr << '\n'
81+
#define sp cerr << ' '
82+
#define ckk cerr << "###############\n"
83+
#define debug1(x) cerr << #x << ": " << (x) << '\n'
84+
#define debug2(x, y) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\n'
85+
#define debug3(x, y, z) cerr << #x << ": " << (x) << '\t' << #y << ": " << (y) << '\t' << #z << ": " << (z) << '\n'
86+
#else
87+
#define nl
88+
#define sp
89+
#define ckk
90+
#define debug1(x)
91+
#define debug2(x, y)
92+
#define debug3(x, y, z)
93+
#endif
94+
95+
#define PI acos(-1.0)
96+
#define INF 0x7fffffff
97+
#define MOD 1000000007
98+
#define EPS 1e-7
99+
#define MAX 10000007 //1e7+7
100+
101+
////////////////////////// START HERE //////////////////////////
102+
103+
double area (int x1, int y1, int x2, int y2, int x3, int y3) {
104+
return (double) abs ((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
105+
}
106+
107+
bool check (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,
108+
int x, int y) {
109+
double A = area (x1, y1, x2, y2, x3, y3) +
110+
area (x1, y1, x4, y4, x3, y3);
111+
double A1 = area (x, y, x1, y1, x2, y2);
112+
double A2 = area (x, y, x2, y2, x3, y3);
113+
double A3 = area (x, y, x3, y3, x4, y4);
114+
double A4 = area (x, y, x1, y1, x4, y4);
115+
return (A == A1 + A2 + A3 + A4);
116+
}
117+
118+
int main() {
119+
_FastIO;
120+
int n, d, m, x, y;
121+
cin >> n >> d >> m;
122+
123+
while (m--) {
124+
cin >> x >> y;
125+
bool ans = check (0, d, d, 0, n, n - d, n - d, n, x, y);
126+
cout << (ans ? "YES\n" : "NO\n");
127+
}
128+
129+
return 0;
130+
}

0 commit comments

Comments
 (0)