답안 #473308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473308 2021-09-15T11:53:24 Z Ahmed_Solyman Garaža (COCI17_garaza) C++14
0 / 160
4000 ms 2192 KB
#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

garaza.cpp: In function 'int main()':
garaza.cpp:26:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for(ll i=0;i<v.size();i++){
      |                        ~^~~~~~~~~
garaza.cpp:28:29: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                 for(ll j=i;j<v.size();j++){
      |                            ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 656 ms 204 KB Output is correct
2 Execution timed out 4070 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4083 ms 688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4078 ms 1060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4054 ms 2192 KB Time limit exceeded
2 Halted 0 ms 0 KB -