답안 #572256

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572256 2022-06-04T07:13:57 Z Adiletm Radio (COCI22_radio) C++14
0 / 110
1500 ms 520 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define endl '\n'
#define ibase ios::sync_with_stdio(false); cin.tie(0);  cout.tie(0)
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse,-fgcse-lm")
#pragma GCC optimize("-ftree-pre,-ftree-vrp")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int N = 503;
const int MOD = 1e9 + 7;
int a[N][N];
int cnt[N][N];
void solve() {
   int n,q;
   cin >> n >> q;
   set < int > sp;
   while(q--){
        char s;
        cin >> s;
        if(s == 'C'){
            int l, r;
            cin >> l >> r;
            vector < int > k;
            for (auto to : sp){
                if(to >= l && to <= r) k.pb(to);
            }
            bool ok =0;
            for (int i=0; i<k.size(); i++){
                for (int j=i+1; j<k.size(); j++){
                    int d = __gcd(k[i], k[j]);
                    if(d > 1) ok = 1;
                }
            }
            if(ok) cout << "DA" << endl;
            else cout << "NE" << endl;
        }
        else{
            int x;
            cin >> x;
            sp.insert(x);
        }
   }
}
signed main(){
    ibase;
    //freopen("bridges.in", "r", stdin);
    //freopen("bridges.out", "w", stdout);
    int t = 1;
    //cin >> t;
    // 1 2 A B S D 8 0
    while (t--){
        solve();
    }
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:36:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             for (int i=0; i<k.size(); i++){
      |                           ~^~~~~~~~~
Main.cpp:37:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |                 for (int j=i+1; j<k.size(); j++){
      |                                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1574 ms 520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -