Submission #58284

#TimeUsernameProblemLanguageResultExecution timeMemory
58284okaybody10허수아비 (JOI14_scarecrows)C++98
15 / 100
4067 ms6968 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int main() { int n; scanf("%d",&n); pii v[200007]; for(int i=0;i<n;i++) scanf("%d %d",&v[i].first,&v[i].second); sort(v,v+n); int ans=0; for(int i=0;i<n;i++) { stack<int> down,up; int y=v[i].second; for(int j=i+1;j<n;j++) { int y1=v[j].second; if(y<y1) { if(up.size()==0) up.push(y1); else if(up.top()>y1) up.push(y1); } } ans+=down.size(); ans+=up.size(); } return !printf("%d",ans); } // 1. 좌표압축 // 2. 세그먼트 트리로 그것보다 큰거과 작은거 관리해주기 // 3. salesman과 동일하게 풀면 될듯

Compilation message (stderr)

scarecrows.cpp: In function 'int main()':
scarecrows.cpp:6:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n; scanf("%d",&n);
            ~~~~~^~~~~~~~~
scarecrows.cpp:8:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++) scanf("%d %d",&v[i].first,&v[i].second);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...