제출 #108434

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1084342019-04-29 12:52:19tjd229Triangles (CEOI18_tri)C++14
20 / 100
3 ms512 KiB
#include <stdio.h>
#include "trilib.h"
#include <vector>
#include <algorithm>
#define pii pair<int,int>
using namespace std;
int piv = 1;
bool cmp(int a, int b) {
return is_clockwise(piv,b,a);
}
void make_hull(vector<int> &h,vector<int> &v) {
int i;
for (i = 0; i < 2 && i < v.size(); ++i) h.push_back(v[i]);
for (; i < v.size(); ++i) {
while (h.size() > 1 && is_clockwise(h[h.size() - 2], h.back(), v[i]))
h.pop_back();
h.push_back(v[i]);
}
}
int main() {
int n = get_n();//[1,n]
vector<int > u, d;
vector<int> hu, hd,ans;
for (int i = 3; i <= n; ++i) {
if (is_clockwise(1, 2, i)) d.push_back(i);
else u.push_back(i);
}
stable_sort(u.begin(), u.end(), cmp);
stable_sort(d.begin(), d.end(), cmp);
make_hull(hu, u); make_hull(hd, d);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

tri.cpp: In function 'void make_hull(std::vector<int>&, std::vector<int>&)':
tri.cpp:13:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < 2 && i < v.size(); ++i) h.push_back(v[i]);
                       ~~^~~~~~~~~~
tri.cpp:14:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (; i < v.size(); ++i) {
         ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...