# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
163397 | davitmarg | 철로 (IOI14_rail) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;
#ifndef death
#include "rail.h"
#endif
#ifdef death
int getDistance(int a, int b)
{
cout << a << " : " << b << endl;
cin >> a;
return a;
}
#endif
void findLocation(int n, int POS, int location[], int stype[])
{
location[0] = POS;
stype[0] = 1;
vector<pair<int, int>> x;
vector<pair<int, int>> R, L;
for (int i = 1; i < n; i++)
{
int d = getDistance(0, i);
x.PB(MP(i, d));
}
sort(all(x));
R.PB(x[0]);
for (int i = 1; i < x.size(); i++)
{
int d = getDistance(R[0]].first, x[i].first);
if (d == x[i].second + R[0]].second)
R.PB(x[i]);
else
L.PB(x[i]);
}
for (int i = 0; i < R.size(); i++)
{
location[R[i].first] = POS + R[i].second;
stype[R[i].first] = 2;
}
for (int i = 0; i < L.size(); i++)
{
int d = R[0].second;
location[L[i].first] = POS - (L[i].second - d - d + 1) + 1;
stype[L[i].first] = 1;
}
}
#ifdef death
int main()
{
int N, FR = 0, LOC[102], TYP[102];
cin >> N;
findLocation(N, FR, LOC, TYP);
for (int i = 0; i < N; i++)
{
cout << LOC[i] << " : " << TYP[i] << endl;
}
return 0;
}
#endif
/*
4
3
4
8
7
6
*/
컴파일 시 표준 에러 (stderr) 메시지
rail.cpp: In function 'void findLocation(int, int, int*, int*)': rail.cpp:52:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i < x.size(); i++) ~~^~~~~~~~~~ rail.cpp:54:33: error: expected ')' before ']' token int d = getDistance(R[0]].first, x[i].first); ^ rail.cpp:55:30: error: no match for 'operator+' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}') if (d == x[i].second + R[0]].second) In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/char_traits.h:39, from /usr/include/c++/7/ios:40, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:397:5: note: candidate: template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&) operator+(typename reverse_iterator<_Iterator>::difference_type __n, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:397:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::reverse_iterator<_Iterator>' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/char_traits.h:39, from /usr/include/c++/7/ios:40, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:1198:5: note: candidate: template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&) operator+(typename move_iterator<_Iterator>::difference_type __n, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1198:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::move_iterator<_IteratorL>' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5876:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5876:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:53:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.tcc:1157:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(const _CharT* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.tcc:1157:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const _CharT*' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:53:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.tcc:1173:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/basic_string.tcc:1173:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5913:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5913:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5929:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5929:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5941:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5941:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5947:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5947:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5953:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5953:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5965:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(const _CharT* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5965:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'const _CharT*' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5971:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) operator+(_CharT __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5971:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5977:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5977:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/string:52:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from rail.cpp:2: /usr/include/c++/7/bits/basic_string.h:5983:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT) operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/basic_string.h:5983:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' if (d == x[i].second + R[0]].second) ^ In file included from /usr/include/c++/7/vector:65:0, from rail.cpp:5: /usr/include/c++/7/bits/stl_bvector.h:297:3: note: candidate: std::_Bit_iterator std::operator+(std::ptrdiff_t, const std::_Bit_iterator&) operator+(ptrdiff_t __n, const _Bit_iterator& __x) ^~~~~~~~ /usr/include/c++/7/bits/stl_bvector.h:297:3: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' to 'const std::_Bit_iterator&' /usr/include/c++/7/bits/stl_bvector.h:387:3: note: candidate: std::_Bit_const_iterator std::operator+(std::ptrdiff_t, const std::_Bit_const_iterator&) operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) ^~~~~~~~ /usr/include/c++/7/bits/stl_bvector.h:387:3: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' to 'const std::_Bit_const_iterator&' In file included from /usr/include/c++/7/deque:64:0, from /usr/include/c++/7/queue:60, from rail.cpp:10: /usr/include/c++/7/bits/stl_deque.h:374:5: note: candidate: template<class _Tp, class _Ref, class _Ptr> std::_Deque_iterator<_Tp, _Ref, _Ptr> std::operator+(std::ptrdiff_t, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&) operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) ^~~~~~~~ /usr/include/c++/7/bits/stl_deque.h:374:5: note: template argument deduction/substitution failed: rail.cpp:55:35: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' if (d == x[i].second + R[0]].second) ^ rail.cpp:55:36: error: expected ')' before ']' token if (d == x[i].second + R[0]].second) ^ rail.cpp:55:36: error: expected primary-expression before ']' token rail.cpp:60:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < R.size(); i++) ~~^~~~~~~~~~ rail.cpp:66:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < L.size(); i++) ~~^~~~~~~~~~