Submission #1195175

#TimeUsernameProblemLanguageResultExecution timeMemory
1195175vnedu허수아비 (JOI14_scarecrows)C++17
5 / 100
32 ms2776 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; template<class T> bool maximize(T &a, const T &b){ return (a < b ? a = b, 1 : 0); } template<class T> bool minimize(T &a, const T &b){ return (a > b ? a = b, 1 : 0); } #define fi first #define se second #define pb push_back #define ii pair<int, int> #define all(x) x.begin(), x.end() #define TASK "nonsense" /// end of template /// const int N = 2e5 + 10; struct Point { int x,y; Point() {} void input() { cin>>x>>y; } bool operator < (const Point &S) const { return x<S.x; } } point[N]; int n,a[N]; namespace sub1 { bool check() { return (n<=400); } void solve() { int ans=0; for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) if(a[i]<a[j]) { bool ok=1; for(int k=i+1;k<j;++k) if(a[i]<a[k] && a[k]<a[j]) ok=0; ans+=ok; } cout<<ans; } } void solve() { cin>>n; for(int i=1;i<=n;++i) point[i].input(); sort(point+1,point+1+n); for(int i=1;i<=n;++i) a[i]=point[i].y; if(sub1::check()) return void(sub1::solve()); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen(TASK".inp","r",stdin); // freopen(TASK".out","w",stdout); int testcase=1; // cin>>testcase; while (testcase--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...