# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473308 | Ahmed_Solyman | Garaža (COCI17_garaza) | C++14 | 4083 ms | 2192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,q;cin>>n>>q;
ll arr[n];
for(auto &i:arr)cin>>i;
while(q--){
ll type;cin>>type;
if(type==1){
ll i,v;cin>>i>>v;
arr[i-1]=v;
}
else{
ll l,r;cin>>l>>r;
ll ans=0;
vector<ll>v;
l--;r--;
for(ll i=l;i<=r;i++){
v.push_back(arr[i]);
}
for(ll i=0;i<v.size();i++){
ll gcd=0;
for(ll j=i;j<v.size();j++){
gcd=__gcd(gcd,v[j]);
ans+=(gcd>1);
}
}
cout<<ans<<endl;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |