Skip to content

Commit fa347c2

Browse files
committed
Codeforces Round Div 627
Codeforces Round Div 627
1 parent 025e3ee commit fa347c2

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
#include <iostream>
22
#include <algorithm>
3-
#include <string>
3+
#include <vector>
44
using namespace std;
5+
vector<int>v;
56
int main() {
67
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
78
int t; cin >> t;
89
while (t--) {
9-
string s = ' ';
10-
string a; cin >> a;
11-
a += 'R';
12-
char prev ='L'
13-
int dist = 0;
14-
int tmp = 0;
15-
for (int i = 0; i < s.length(); i++) {
16-
if (prev == 'L') {
17-
tmp += 1;
18-
dist = max(dist, tmp);
19-
}
20-
else if (prev == 'R') {
21-
dist = max(dist, tmp);
22-
tmp = 0;
10+
int n; cin >> n;
11+
bool flag = false;
12+
for (int i = 0; i < n; i++) {
13+
int x; cin >> x; v.push_back(x);
14+
}
15+
for (int i = 0; i < v.size() - 2; i++) {
16+
if (flag) break;
17+
for (int j = i + 2; j < v.size(); j++) {
18+
if (v[i] == v[j]) {
19+
flag = true;
20+
break;
21+
}
2322
}
24-
prev = s[
2523
}
24+
if (flag) cout << "YES\n";
25+
else cout << "NO\n";
26+
v.clear();
2627
}
2728
return 0;
2829
}

CodeForce/Round #627 (Div. 3)/C- Frog Jumps.cpp CodeForce/Round #627 (Div. 3)/C - Frog Jumps.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main() {
1616
pos = i;
1717
}
1818
}
19-
tmp = max(tmp, int(s.length()-pos));
19+
tmp = max(tmp, int(s.length() - pos));
2020
cout << tmp << "\n";
2121
}
2222
return 0;

0 commit comments

Comments
 (0)