제출 #320778

#제출 시각아이디문제언어결과실행 시간메모리
320778tjdgus4384산만한 고양이 (KOI17_cat)C++14
23 / 100
215 ms22628 KiB
#include<bits/stdc++.h>
using namespace std;
long long N, M, a, b, ans;
vector<long long> v[300001];

int main(){
    scanf("%lld %lld", &N, &M);
    for(long long i = 0;i < M;i++){
        scanf("%lld %lld", &a, &b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    long long T = M-N+2;
    for(long long i = 1;i <= N;i++){
        if(v[i].size() >= T) ans += i;
    }
    printf("%lld", ans);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

cat.cpp: In function 'int main()':
cat.cpp:15:24: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   15 |         if(v[i].size() >= T) ans += i;
      |            ~~~~~~~~~~~~^~~~
cat.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%lld %lld", &N, &M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
cat.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |         scanf("%lld %lld", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...