제출 #1113602

#제출 시각아이디문제언어결과실행 시간메모리
1113602EfeBabagilNaval battle (CEOI24_battle)C++14
컴파일 에러
0 ms0 KiB
using namespace std; #include <bits/stdc++.h> #define int long long int32_t main() { int n; cin>>n; vector<array<int,3>> ships(n); vector<array<int,3>> x; vector<int> sunk(n,LLONG_MAX); for(int i=0;i<n;i++) { int a,b; char c; cin>>a>>b; cin>>c; ships[i]={a,b,c}; } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(ships[i][2]==ships[j][2]) continue; if(ships[i][2]=='S'&&ships[j][2]=='N'ships[i][1]<ships[j][1]) { if(ships[i][0]==ships[j][0]) { x.push_back({abs(ships[i][1]-ships[j][1])/2,i,j}); } } if(ships[i][2]=='E'&&ships[j][2]=='W'&&ships[i][0]<ships[j][0]) { if(ships[i][1]==ships[j][1]) { x.push_back({abs(ships[i][0]-ships[j][0])/2,i,j}); } } if( ships[i][2]=='S'&&ships[j][2]=='W') { if(ships[i][0]-ships[i][1]==ships[j][0]-ships[j][1]&&ships[i][1]<ships[j][1]) { x.push_back({abs(ships[i][1]-ships[j][1]),i,j}); } } if(ships[i][2]=='S'&&ships[j][2]=='E') { if(ships[i][0]+ships[i][1]==ships[j][0]+ships[j][1]&&ships[i][1]<ships[j][1]) { x.push_back({abs(ships[i][1]-ships[j][1]),i,j}); } } if( ships[i][2]=='N'&&ships[j][2]=='E') { if(ships[i][0]-ships[i][1]==ships[j][0]-ships[j][1]&&ships[i][1]>ships[j][1]) { x.push_back({abs(ships[i][1]-ships[j][1]),i,j}); } } if(ships[i][2]=='N'&&ships[j][2]=='W') { if(ships[i][0]+ships[i][1]==ships[j][0]+ships[j][1]&&ships[i][1]>ships[j][1]) { x.push_back({abs(ships[i][1]-ships[j][1]),i,j}); } } } } sort(x.begin(),x.end()); for(int i=0;i<x.size();i++) { if(sunk[x[i][1]]>=x[i][0]&&sunk[x[i][2]]>=x[i][0]) { sunk[x[i][1]]=x[i][0]; sunk[x[i][2]]=x[i][0]; } } for(int i=0;i<n;i++) { if(sunk[i]==LLONG_MAX) cout<<i+1<<" "; } return 0; }

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

Main.cpp: In function 'int32_t main()':
Main.cpp:34:47: error: unable to find character literal operator 'operator""ships' with 'char' argument
   34 |             if(ships[i][2]=='S'&&ships[j][2]=='N'ships[i][1]<ships[j][1])
      |                                               ^~~~~~~~
Main.cpp:89:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   89 |     for(int i=0;i<x.size();i++)
      |                 ~^~~~~~~~~