Submission #170322

#TimeUsernameProblemLanguageResultExecution timeMemory
170322ngmhGaraža (COCI17_garaza)C++11
0 / 160
4046 ms1528 KiB
#include <bits/stdc++.h> using namespace std; int n, q, t, x, v, l, r, cur, ans, a[100005]; int main(){ cin >> n >> q; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < q; i++){ cin >> t; if(t == 1){ cin >> x >> v; x--; a[x] = v; } else { cin >> l >> r; l--; r--; ans = 0; for(int j = l; j <= r; j++){ cur = a[j]; for(int k = j; k <= r; k++){ cur = __gcd(cur, a[k]); if(cur == 1) break; ans++; } } cout << ans << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...