제출 #1360548

#제출 시각아이디문제언어결과실행 시간메모리
1360548srividya_06September (APIO24_september)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long
#define REP(i,a,b) for(int i = a; i<b; i++)
#define RREP(i,a,b) for(int i = a; i>b; i--)
using namespace std;
int inf = 1e15;
int solve(int N, int M, vector<int> F, vector<vector<int>> S){
    vector<pair<int,int>> srt;
    REP(i,0,S[0].size()){
        srt.push_back({s[0][i],i});
    }
    sort(srt.begin(),srt.end(),greater<pair<int,int>>());
    int cnt = 0, curr = -1;
    REP(i,0,S[0].size()){
        if(srt[i].second > curr){
            curr = srt[i].second;
            cnt++;
        }
    }
    return cnt;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<solve(3, 1, {-1, 0, 1},{{2, 1}})<<"\n";
}

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

september.cpp: In function 'long long int solve(long long int, long long int, std::vector<long long int>, std::vector<std::vector<long long int> >)':
september.cpp:10:24: error: 's' was not declared in this scope
   10 |         srt.push_back({s[0][i],i});
      |                        ^
september.cpp:10:22: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   10 |         srt.push_back({s[0][i],i});
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from september.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:1281:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1281 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1281:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1281 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:1298:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1298 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1298:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1298 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~