結果
問題 | No.1380 Borderline |
ユーザー |
|
提出日時 | 2021-02-07 20:34:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 5,154 bytes |
コンパイル時間 | 1,627 ms |
コンパイル使用メモリ | 168,436 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 16:57:11 |
合計ジャッジ時間 | 2,937 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define repd(i,a,b) for (int i=(a);i<(b);i++)#define rep(i,n) repd(i,0,n)using ll = long long;using ld = long double;#define int ll#define double ld#define VARNAME(v) #vusing P = pair<int,int>;constexpr int MOD = 1000000007;//constexpr int MOD = 998244353;constexpr ll INF = 1e16;#pragma region tmpconstexpr double EPS = 1e-10;constexpr double PI = 3.141592653589793;const string endn = "\n";const string abc="abcdefghijklmnopqrstuvwxyz";const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";template<class T1, class T2>ostream &operator<<(ostream &out, const pair<T1, T2> &o){out << "(" << o.first << ", " << o.second << ")";return out;}template<class T> ostream &operator<<(ostream &out, const vector<T> &o){for(auto itr=o.begin();itr != o.end();itr++)out << *itr << (itr+1 != o.end()? " " : "");return out;}template<class T> ostream &operator<<(ostream &out, const deque<T> &o){for(auto itr=o.begin();itr != o.end();itr++)out << *itr << (itr+1 != o.end() ?" " : "");return out;}template<class T> ostream &operator<<(ostream &out, const set<T> &o){out << "{";for(auto itr=o.begin();itr != o.end();itr++)out << *itr << (next(itr,1) != o.end() ? "," : "");out << "}";return out;}template<class T> ostream &operator<<(ostream &out, const multiset<T> &o){out << "{";for(auto itr=o.begin();itr != o.end();itr++)out << *itr << (next(itr,1) != o.end() ? "," : "");out << "}";return out;}template<class T, class U> ostream &operator<<(ostream &out, const map<T, U> &o){out << "{";for(auto itr=o.begin();itr != o.end();itr++)out << *itr<< (next(itr,1) != o.end() ? " " : "");out << "}";return out;}template<class T, class U> ostream &operator<<(ostream &out, const multimap<T, U> &o){out << "{";for(auto itr=o.begin();itr != o.end();itr++)out <<*itr << (next(itr,1) != o.end() ? " " : "");out << "}";return out;}template<class T> ostream &operator<<(ostream &out, queue<T> o){while(!o.empty())out << o.front() << (o.size() > 0 ? " " : ""),o.pop();return out;}template<class T, class U> ostream &operator<<(ostream &out, priority_queue<T, vector<T>, U> o){while(!o.empty())out << o.top() << (o.size() > 0 ? "" : ""),o.pop();return out;}template<class T> ostream &operator<<(ostream &out, stack<T> o){while(!o.empty())out << o.top() << (o.size() > 0 ? " " : ""),o.pop();return out;}template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}template<class T> inline bool chmin(T& a, initializer_list<T> b){T c = min(b);if(a>c){a = c;return 1;}return 0;}template<class T> inline bool chmax(T& a, initializer_list<T> b){T c = max(b);if(a<c){a = c;return 1;}return 0;}inline int mrep(int& a, int M=MOD){a%=M;return a=(a<0 ? a+M : a);}inline int add(int& a, int b, int M=MOD){return a=(mrep(a,M)+mrep(b,M))%M;}inline int mul(int& a, int b, int M=MOD){return a=(mrep(a,M)*mrep(b,M))%M;}inline int add(int& a, initializer_list<int> b, int M=MOD){return a=(mrep(a,M)+accumulate(b.begin(), b.end(), (int)0, [&M](int acc, int i){return(acc+mrep(i,M))%M;}))%M;}inline int mul(int& a, initializer_list<int> b, int M=MOD){return a=(mrep(a,M)*accumulate(b.begin(), b.end(), (int)1, [&M](int acc, int i){return(acc*mrep(i,M))%M;}))%M;}inline int modpow(int b, int e, int M=MOD){int ret=1;while(e > 0){if(e%2)mul(ret,b,M);mul(b,b,M);e /= 2;};return ret;}inline int modinv(int a, int M=MOD){int b=M,u=1,v=0;while(b){int t=a/b;a-=t*b;swap(a,b);u-=t*v;swap(u,v);}return mrep(u,M);}template<class T> inline void print(T a){cout << a << endl;}template<class T> inline void print(vector<T> a, int n){chmin(n,int(a.size()));rep(i,n)cout << a[i] << (i != n-1 ? " " : "\n");}template<class T, size_t SIZE> inline void print(T (&a)[SIZE], int n=SIZE){chmin(n,int(SIZE));rep(i,n)cout << a[i] << (i != n-1 ? " ":"\n");}#pragma #endregion tmp#define vint vector<int>class union_find{int N;vector<int> par;public:union_find(int N){par.resize(N);rep(i,N)par[i] = -1;}int find(int x){if(par[x] < 0)return x;else{return par[x] = find(par[x]);}}void unite(int x, int y){x = find(x);y = find(y);if(x == y)return;par[y] += par[x];par[x] = y;}bool same(int x, int y){return find(x) == find(y);}int size(int x){return -par[find(x)];}};template<typename T>struct edge {int to, from;T cost;edge(int to) : from(-1), to(to), cost(-1) {}edge(int to, T cost) : from(-1), to(to), cost(cost) {}edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}};template<typename T>using edges = vector<edge<T>>;template<typename T>using graph = vector<edges<T>>;template<typename T>using matrix = vector<vector<T>>;template<typename T>bool compByCost(const edge<T>& left, const edge<T>& right){return left.cost < right.cost;}signed main(){int n,k;cin>>n>>k;int p[200];rep(i,n)cin>>p[i];rep(i,500){int cnt = 0;rep(j,n)cnt += (p[j] >= i);if(cnt <= k){cout << cnt << endl;return 0;}}}