Submission #12837

# Submission time Handle Problem Language Result Execution time Memory
12837 2015-01-10T00:11:51 Z yongwhan 덩치 (KOI13_body) C++
Compilation error
0 ms 0 KB
#include<iostream>
#include<utility>
#include<vector>
using namespace std;

int main() {
	int n; cin>>n;
  vector<int> v(n);
  for (int i=0; i<n; i++) {
  	int x,y; cin>>x>>y;
    v[i]=make_pair(x,y);
  }
  
  vector<int> ret(n);
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) if(i!=j) {
      if(v[j].first>v[i].first && v[j].second>v[i].first) ret[i]++;
    }
  }
  
  for (int i=0; i<n; i++) {
    if(i) cout << " ";
    cout << ret[i]+1;
  }
  cout << endl;
  return 0;
}

Compilation message

bb.cpp: In function 'int main()':
bb.cpp:11:23: error: cannot convert 'std::pair<int, int>' to 'int' in assignment
bb.cpp:17:15: error: request for member 'first' in 'v.std::vector<_Tp, _Alloc>::operator[] [with _Tp = int, _Alloc = std::allocator<int>, std::vector<_Tp, _Alloc>::reference = int&, std::vector<_Tp, _Alloc>::size_type = long unsigned int](((long unsigned int)j))', which is of non-class type 'int'
bb.cpp:17:26: error: request for member 'first' in 'v.std::vector<_Tp, _Alloc>::operator[] [with _Tp = int, _Alloc = std::allocator<int>, std::vector<_Tp, _Alloc>::reference = int&, std::vector<_Tp, _Alloc>::size_type = long unsigned int](((long unsigned int)i))', which is of non-class type 'int'
bb.cpp:17:40: error: request for member 'second' in 'v.std::vector<_Tp, _Alloc>::operator[] [with _Tp = int, _Alloc = std::allocator<int>, std::vector<_Tp, _Alloc>::reference = int&, std::vector<_Tp, _Alloc>::size_type = long unsigned int](((long unsigned int)j))', which is of non-class type 'int'
bb.cpp:17:52: error: request for member 'first' in 'v.std::vector<_Tp, _Alloc>::operator[] [with _Tp = int, _Alloc = std::allocator<int>, std::vector<_Tp, _Alloc>::reference = int&, std::vector<_Tp, _Alloc>::size_type = long unsigned int](((long unsigned int)i))', which is of non-class type 'int'