답안 #1087513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087513 2024-09-12T19:53:02 Z idk__ Izbori (COCI17_izbori) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 101, M = 16;
int n, m, k, ans=0, poi[N], a[N][M], count, num, cnt[M];

int main() {
    cin >> n >> m >> k;

    for(int i = 0;i < n; i++){
        for(int j = 0;j < m ;j++){
            cin >> a[i][j];
        }
    }
    
    while(true){
        
        count=0, num=-1;
        for(int i = 0;i < M; i++)cnt[i]=0;

        for(int i = 0;i < n; i++){
        while(true){
            if(a[i][poi[i]]==-5)poi[i]++;
            else break;

        }
        if(poi[i]==m)continue;
        int& curr = a[i][poi[i]];
        


        cnt[curr]++;
        if((cnt[curr] > count) or (cnt[curr] == count and curr < num)){
            num = curr;
            count=cnt[curr];
        }
        
        
        }
        if(ans==0)cout << num << endl;
        if(num == k or ans == m-1)break;
       
       
        for(int i = 0;i < n; i++){
            for(int j = 0;j < m; j++){
                if(a[i][j]==num)a[i][j]=-5;

            }
        }
        
        ans++;
        
    }
  cout << min(ans, m-1) << endl;
    
    
    }

Compilation message

izbori.cpp: In function 'int main()':
izbori.cpp:18:9: error: reference to 'count' is ambiguous
   18 |         count=0, num=-1;
      |         ^~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izbori.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4077:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4077 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
izbori.cpp:5:38: note:                 'int count'
    5 | int n, m, k, ans=0, poi[N], a[N][M], count, num, cnt[M];
      |                                      ^~~~~
izbori.cpp:33:25: error: reference to 'count' is ambiguous
   33 |         if((cnt[curr] > count) or (cnt[curr] == count and curr < num)){
      |                         ^~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izbori.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4077:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4077 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
izbori.cpp:5:38: note:                 'int count'
    5 | int n, m, k, ans=0, poi[N], a[N][M], count, num, cnt[M];
      |                                      ^~~~~
izbori.cpp:33:49: error: reference to 'count' is ambiguous
   33 |         if((cnt[curr] > count) or (cnt[curr] == count and curr < num)){
      |                                                 ^~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izbori.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4077:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4077 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
izbori.cpp:5:38: note:                 'int count'
    5 | int n, m, k, ans=0, poi[N], a[N][M], count, num, cnt[M];
      |                                      ^~~~~
izbori.cpp:35:13: error: reference to 'count' is ambiguous
   35 |             count=cnt[curr];
      |             ^~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izbori.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4077:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4077 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
izbori.cpp:5:38: note:                 'int count'
    5 | int n, m, k, ans=0, poi[N], a[N][M], count, num, cnt[M];
      |                                      ^~~~~