답안 #994334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994334 2024-06-07T11:46:34 Z tosivanmak 마술쇼 (APIO24_show) C++17
컴파일 오류
0 ms 0 KB
#include "Alice.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
vector<pair<int, int>> Alice() {
  ll x=setN(5000);
  vector<pair<int,int> >edges;
  for(int i=2;i<=5000;i++){
      edges.push_back(x%(i-1)+1);
  }
  return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"
#define ll long long
using namespace std;
 
long long Bob(vector<pair<int,int>> v) {
  for(int i=0;i<v.size();i++){
      v[i].first--,v[i].second--;
      if(v[i].first<v[i].second){
          swap(v[i].first,v[i].second);
      }
  }
  sort(v.begin(),v.end());
  ll val=-1,add;
  for(int i=0;i<v.size();i++){
      if(val==-1){val=v[i].second;add=v[i].first;}
      else{
          while(val%v[i].first!=v[i].second){
              val+=add;
          }
          add=lcm(add,v[i].first);
      }
  }
  return val;
}

Compilation message

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:10:32: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(long long int)'
   10 |       edges.push_back(x%(i-1)+1);
      |                                ^
In file included from /usr/include/c++/10/vector:67,
                 from Alice.h:1,
                 from Alice.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'long long int' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'long long int' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:7:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for(int i=0;i<v.size();i++){
      |               ~^~~~~~~~~
Bob.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int i=0;i<v.size();i++){
      |               ~^~~~~~~~~