# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
942535 |
2024-03-10T20:01:37 Z |
skywwla |
Garaža (COCI17_garaza) |
C++17 |
|
4000 ms |
1624 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 5;
const int MOD = 1e9 + 7 ;
int gcd(int a, int b) {
return ((!b) ? a : gcd(b, a % b)) ;
}
int n, q, a[N] ;
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> q ;
for (int i = 1 ; i <= n ; i++) {
cin >> a[i] ;
}
for (int i = 1 ; i <= q ; i++) {
int cmd; cin >> cmd ;
if (cmd == 1) {
int index, x; cin >> index >> x ;
a[index] = x ;
} else {
int l, r; cin >> l >> r;
ll ret = 0 ;
for (int j = l ; j <= r ; j++) {
int cur = 0 ;
for (int k = j ; k <= r ; k++) {
cur = gcd(cur, a[k]) ;
if (cur == 1) break ;
ret++ ;
}
}
cout << ret << "\n" ;
}
}
return 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
604 KB |
Output is correct |
2 |
Execution timed out |
4065 ms |
512 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4046 ms |
860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4049 ms |
1116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4018 ms |
1624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |