# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
502255 |
2022-01-05T16:08:20 Z |
cig32 |
Crossing (JOI21_crossing) |
C++17 |
|
7000 ms |
6024 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
int u = uniform_int_distribution<int>(x, y)(rng);
return u;
}
long long bm(long long b, long long p) { // bigmod
if(p==0) return 1;
long long r = bm(b, p/2);
if(p&1) return (((r*r) % MOD) * b) % MOD;
return (r*r) % MOD;
}
string gene(string a, string b) {
string c;
for(int i=0; i<a.size(); i++) {
if(a[i] == b[i]) c += a[i];
else {
string t = "JOI";
for(int j=0; j<3; j++) {
if(a[i] != t[j] && b[i] != t[j]) c += t[j];
}
}
}
return c;
}
void solve(int tc) {
int N;
cin >> N;
string s[9];
for(int i=0; i<3; i++) cin >> s[i];
s[3] = gene(s[0], s[1]);
s[4] = gene(s[0], s[2]);
s[5] = gene(s[1], s[2]);
s[6] = gene(s[2], s[3]);
s[7] = gene(s[1], s[4]);
s[8] = gene(s[0], s[5]);
int Q;
cin >> Q;
string t0;
cin >> t0;
for(int i=0; i<=Q; i++) {
if(i > 0) {
int l, r;
cin >> l >> r;
char c;
cin >> c;
for(int j=l-1; j<r; j++) t0[j] = c;
}
bool ret = 0;
for(int j=0; j<9; j++) {
ret |= (s[j] == t0);
}
cout << (ret ? "Yes\n" : "No\n");
}
}
int32_t main(){
ios::sync_with_stdio(0); cin.tie(0);
int t = 1; //cin >> t;
for(int i=1; i<=t; i++) {
solve(i);
}
}
Compilation message
Main.cpp: In function 'std::string gene(std::string, std::string)':
Main.cpp:19:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | for(int i=0; i<a.size(); i++) {
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
2244 KB |
Output is correct |
2 |
Correct |
53 ms |
2368 KB |
Output is correct |
3 |
Correct |
84 ms |
2204 KB |
Output is correct |
4 |
Correct |
49 ms |
2316 KB |
Output is correct |
5 |
Correct |
49 ms |
2240 KB |
Output is correct |
6 |
Correct |
48 ms |
2284 KB |
Output is correct |
7 |
Correct |
47 ms |
2376 KB |
Output is correct |
8 |
Correct |
51 ms |
2312 KB |
Output is correct |
9 |
Correct |
49 ms |
2352 KB |
Output is correct |
10 |
Correct |
64 ms |
2372 KB |
Output is correct |
11 |
Correct |
56 ms |
2372 KB |
Output is correct |
12 |
Correct |
62 ms |
2336 KB |
Output is correct |
13 |
Correct |
49 ms |
2316 KB |
Output is correct |
14 |
Correct |
64 ms |
2308 KB |
Output is correct |
15 |
Correct |
53 ms |
2380 KB |
Output is correct |
16 |
Correct |
52 ms |
2372 KB |
Output is correct |
17 |
Correct |
51 ms |
2368 KB |
Output is correct |
18 |
Correct |
96 ms |
2268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
2244 KB |
Output is correct |
2 |
Correct |
53 ms |
2368 KB |
Output is correct |
3 |
Correct |
84 ms |
2204 KB |
Output is correct |
4 |
Correct |
49 ms |
2316 KB |
Output is correct |
5 |
Correct |
49 ms |
2240 KB |
Output is correct |
6 |
Correct |
48 ms |
2284 KB |
Output is correct |
7 |
Correct |
47 ms |
2376 KB |
Output is correct |
8 |
Correct |
51 ms |
2312 KB |
Output is correct |
9 |
Correct |
49 ms |
2352 KB |
Output is correct |
10 |
Correct |
64 ms |
2372 KB |
Output is correct |
11 |
Correct |
56 ms |
2372 KB |
Output is correct |
12 |
Correct |
62 ms |
2336 KB |
Output is correct |
13 |
Correct |
49 ms |
2316 KB |
Output is correct |
14 |
Correct |
64 ms |
2308 KB |
Output is correct |
15 |
Correct |
53 ms |
2380 KB |
Output is correct |
16 |
Correct |
52 ms |
2372 KB |
Output is correct |
17 |
Correct |
51 ms |
2368 KB |
Output is correct |
18 |
Correct |
96 ms |
2268 KB |
Output is correct |
19 |
Execution timed out |
7051 ms |
6024 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
2244 KB |
Output is correct |
2 |
Correct |
53 ms |
2368 KB |
Output is correct |
3 |
Correct |
84 ms |
2204 KB |
Output is correct |
4 |
Correct |
49 ms |
2316 KB |
Output is correct |
5 |
Correct |
49 ms |
2240 KB |
Output is correct |
6 |
Correct |
48 ms |
2284 KB |
Output is correct |
7 |
Correct |
47 ms |
2376 KB |
Output is correct |
8 |
Correct |
51 ms |
2312 KB |
Output is correct |
9 |
Correct |
49 ms |
2352 KB |
Output is correct |
10 |
Correct |
64 ms |
2372 KB |
Output is correct |
11 |
Correct |
56 ms |
2372 KB |
Output is correct |
12 |
Correct |
62 ms |
2336 KB |
Output is correct |
13 |
Correct |
49 ms |
2316 KB |
Output is correct |
14 |
Correct |
64 ms |
2308 KB |
Output is correct |
15 |
Correct |
53 ms |
2380 KB |
Output is correct |
16 |
Correct |
52 ms |
2372 KB |
Output is correct |
17 |
Correct |
51 ms |
2368 KB |
Output is correct |
18 |
Correct |
96 ms |
2268 KB |
Output is correct |
19 |
Correct |
50 ms |
2216 KB |
Output is correct |
20 |
Correct |
90 ms |
2316 KB |
Output is correct |
21 |
Correct |
53 ms |
2400 KB |
Output is correct |
22 |
Correct |
44 ms |
2180 KB |
Output is correct |
23 |
Correct |
55 ms |
2380 KB |
Output is correct |
24 |
Correct |
45 ms |
2244 KB |
Output is correct |
25 |
Correct |
50 ms |
2312 KB |
Output is correct |
26 |
Correct |
51 ms |
2244 KB |
Output is correct |
27 |
Correct |
53 ms |
2380 KB |
Output is correct |
28 |
Correct |
48 ms |
2220 KB |
Output is correct |
29 |
Correct |
52 ms |
2420 KB |
Output is correct |
30 |
Correct |
49 ms |
2240 KB |
Output is correct |
31 |
Correct |
53 ms |
2376 KB |
Output is correct |
32 |
Correct |
53 ms |
2388 KB |
Output is correct |
33 |
Correct |
59 ms |
2408 KB |
Output is correct |
34 |
Correct |
58 ms |
2216 KB |
Output is correct |
35 |
Correct |
49 ms |
2312 KB |
Output is correct |
36 |
Correct |
48 ms |
2332 KB |
Output is correct |
37 |
Correct |
50 ms |
2360 KB |
Output is correct |
38 |
Correct |
54 ms |
2312 KB |
Output is correct |
39 |
Correct |
51 ms |
2356 KB |
Output is correct |
40 |
Correct |
51 ms |
2340 KB |
Output is correct |
41 |
Correct |
54 ms |
2392 KB |
Output is correct |
42 |
Correct |
49 ms |
2376 KB |
Output is correct |
43 |
Correct |
49 ms |
2332 KB |
Output is correct |
44 |
Correct |
64 ms |
2400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
2244 KB |
Output is correct |
2 |
Correct |
53 ms |
2368 KB |
Output is correct |
3 |
Correct |
84 ms |
2204 KB |
Output is correct |
4 |
Correct |
49 ms |
2316 KB |
Output is correct |
5 |
Correct |
49 ms |
2240 KB |
Output is correct |
6 |
Correct |
48 ms |
2284 KB |
Output is correct |
7 |
Correct |
47 ms |
2376 KB |
Output is correct |
8 |
Correct |
51 ms |
2312 KB |
Output is correct |
9 |
Correct |
49 ms |
2352 KB |
Output is correct |
10 |
Correct |
64 ms |
2372 KB |
Output is correct |
11 |
Correct |
56 ms |
2372 KB |
Output is correct |
12 |
Correct |
62 ms |
2336 KB |
Output is correct |
13 |
Correct |
49 ms |
2316 KB |
Output is correct |
14 |
Correct |
64 ms |
2308 KB |
Output is correct |
15 |
Correct |
53 ms |
2380 KB |
Output is correct |
16 |
Correct |
52 ms |
2372 KB |
Output is correct |
17 |
Correct |
51 ms |
2368 KB |
Output is correct |
18 |
Correct |
96 ms |
2268 KB |
Output is correct |
19 |
Execution timed out |
7051 ms |
6024 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |