Source
stringclasses
1 value
Date
int64
2.01k
2.02k
Text
stringlengths
22
783k
Token_count
int64
20
394k
Project_CodeNet
2,020
#import<bits/stdc++.h> #define endl '\n' using namespace std; typedef long long LL; typedef struct{LL x;LL i;}H; LL i,j,k,m,n,s,x,p[2][2040]; H w[2040]; int C(H a,H b){return a.x<b.x;} main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(;i<n;i++) { cin>>w[i].x; w[i].i=i+1; } sort(w,w...
249
Project_CodeNet
2,020
#include <iostream> #include <vector> #include <map> #include <set> #include <string> #include <utility> #include <algorithm> #include <cstdio> #include <iomanip> #include <queue> #include <deque> #include <stack> #include <fstream> #include <cmath> #include <random> #include <complex> #include <functional> #define ll...
451
Project_CodeNet
2,020
#include <stdio.h> #include <algorithm> long long n, m, x, ans; long long a[2000]; long long dp[2001]; long long e[2001]; int main() { scanf("%lld", &n); for (long long i = 0; i < n; i++) { scanf("%lld", a + i); a[i] = a[i] * 10000 + i; } std::sort(a, a + n); for (long long i = n - 1; i >= 0; i--) { for (lon...
324
Project_CodeNet
2,020
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
4,348
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(a,n) for (ll a = 0; a < (n); ++a) using namespace std; typedef long long ll; using ll = long long; typedef pair<ll,ll> P; typedef pair<P,ll> PP; 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, T b...
445
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { /* {{{ */ if (a < b) { a = b; return true; } return false; } /* }}} */ int main() { int N; cin >> N; vector<pair<long long, int>> A(N); for (int i = 0; i < N; i++) { long long a; cin >> a; ...
323
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld PIE = atan2(0, -1); const ll MOD = 1e9 + 7; const int MAXN = 2e3 + 5; int n; int a[MAXN]; ll dp[MAXN][MAXN]; bool cmp(int i, int j) { return a[i] > a[j]; } void solve() { cin >> n; for (int i = 0; i < n; ++i) ci...
433
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define N 3009 #define inf 1e18 int mod=1e9+7; int maxN=1e9; #define P pair<int,int> P v[N]; int dp[N][N]; int n; int fun(int idx,int l,int r){ if(idx>n)return 0; int &ans=dp[l][r]; if(ans!=-1)return ans; int x=ab...
277
Project_CodeNet
2,020
#include <bits/stdc++.h> //typedef //-------------------------#include <bits/stdc++.h> const double pi = 3.141592653589793238462643383279; using namespace std; //conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template<class...
2,127
Project_CodeNet
2,020
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef pair<long long, int> P; int n; vector<P> ai; vector< vector< long long > > dp; long long f(int i, int to){ return ai[i].first * abs(ai[i].second-to); } int main(void){ cin >> n; ai.push_back(P(1e18, 0)); for(int i=...
338
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; pair<long, int> a[2222]; long d[2222][2222]; int main() { int n; cin >> n; for(int i = 0; i < n; i++) { int x; scanf("%d", &x); a[i] = {x, i}; } sort(a, a + n); for(int l = 1; l <= n; l++) { for(int i = 0; i + l <= n;...
208
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; //using ll = int64_t; using ll = long long; using ull = uint64_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using pii = pair<int, int>; using pll = pair<ll, ll>; using ld = double; #define X first #define Y second #ifndef ONLI...
1,550
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) typedef pair<ll,ll> P; template <class T>bool chmax(T& a, T b){ if (a < b){ a = b; return 1; } return 0; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int ...
288
Project_CodeNet
2,020
//#include <bits/stdc++.h> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #in...
759
Project_CodeNet
2,020
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define sz(x) (int)(x).size() #define uni(x) x.erase(unique(rng(x)),x.end()) #defin...
537
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) using namespace std; typedef long long ll; typedef pair<ll, ll> PI; typedef vector<ll> VI; typedef vector<VI> VVI; typedef vector<PI> VPI; int ...
444
Project_CodeNet
2,020
//by Top1 #include <bits/stdc++.h> #define f first #define s second #define int long long #define ld long double #define ull unsigned long long #define pii pair <int, int> #define pll pair <long, long> #define mp make_pair #define pb push_back #define pf push_front #define pp pop_back #define cerr cout #defi...
532
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; pair<ll,ll> a[2005]; ll d[2005][2005]; int main(){ ll n,ans=0; cin>>n; for(ll i=1;i<=n;i++){ cin>>a[i].first; a[i].second=i; } sort(a+1,a+1+n); reverse(a+1,a+1+n); for(ll i=1;i<=n;i++){ ...
259
Project_CodeNet
2,020
#include<bits/stdc++.h> #define int long long #define endl '\n' #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define bug1( x ) {cerr << (#x) <<"="<< x << endl;} #define bug2( x , y ) {cerr << (#x) <<"="<< (x) << " " << (#y) << "="<< (y) << endl;} #define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) <<...
745
Project_CodeNet
2,020
#include "bits/stdc++.h" #include <random> using namespace std; using ll =long long; using dd =double; using pll =pair<ll, ll>; using tll =tuple<ll,ll,ll>; using vll =vector<ll>; using vdd =vector<dd>; using vpll =vector<pll>; using vtll =vector<tll>; using vvll =vector<vll>; using...
3,791
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<pair<int, int>> A(n); for (int i=0; i<n; i++) { int a; cin >> a; A[i] = make_pair(a, i); } sort(A.begin(), A.end(), greater<pair<int, int>>()); ll dp[n+1][n+1]; for (int i=0; i<=n; i++...
316
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename L> using gpp_map = tre...
1,083
Project_CodeNet
2,020
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(x) (x).begin(),(x).end() #define ln '\n' constexpr long long MOD = 1000000007LL; //constexpr long long MOD = 998244353LL; typedef long long ll; typedef unsigned long long ull; typedef ...
382
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define int long long pair < int, int > a[2005]; int dp[2005][2005]; int inf = 1e18; main() { #ifdef HOME //freopen("input.txt", "r", stdin); #endif // HOME ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, pos = 1; cin >> n; for (...
361
Project_CodeNet
2,020
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define INF (1LL<<59) #define MV 200001 #define LMV 21 #define ff first #define ss second #define pb push_back #define eb emplace_back #define emp emplace #define whoam...
1,052
Project_CodeNet
2,020
//2020年4月17日現在 #include<stdio.h> #include<cmath> #include<math.h> #include<iostream> #include<string> #include<vector> #include<algorithm> #include<complex> #include<queue> #include<set> #include<utility> #include<iomanip> #include<limits> #include<thread> #include<map> #include<stack> #include<numeric> #include<casse...
936
Project_CodeNet
2,020
#include <bits/stdc++.h> #include <boost/multiprecision/cpp_int.hpp> using namespace std; using bint = boost::multiprecision::cpp_int; using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>; #define rep(i,n) for (int i = 0; i < (n); i++) #define repSE(i,s,n) for (int i = (s); i < (n); i++) #define ...
908
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; pair<int64_t, int> p[2000]; cin >> n; for(int i=0;i<n;++i){ int a; cin >> a; p[i] = {a, i}; } sort(p, p+n, greater()); static int64_t dp[2001]...
301
Project_CodeNet
2,020
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools #include <bits/stdc++.h> using namespace std; using i64 = long long; const i64 MOD = 1e9 + 7; const i64 INF = i64(1e18) + 7; template <typename T> bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; ...
446
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, beg, end, step) for (ll i = beg; i < end; i += step) int main() { ll n; cin >> n; vector<pair<ll, ll>> table; rep(i, 0, n, 1) { ll a; cin >> a; table.push_back({a, i + 1}); } sort(tabl...
460
Project_CodeNet
2,020
//abc163_e.cpp //Sun Apr 19 20:58:09 2020 #include <iostream> #include <string> #include <queue> #include <map> #include <unordered_map> #include <vector> #include <algorithm> #include <math.h> #include <set> #define INTINF 2147483647 #define LLINF 9223372036854775807 #define MOD 1000000007 using namespace std; using...
378
Project_CodeNet
2,020
/* ██████ ██████ ██ ██ ██ ██ Author -> ██████ ██ ██ ██ ██ ██ ██ ██████ nik is love. nik is motivation. Ek modulus aapki jindagi barbaad kar sakti hai Watch for integer overflows. A dream doesn't become reality through magic; it ...
1,075
Project_CodeNet
2,020
#include <iostream> #include <vector> #include <queue> #include <math.h> #include <unordered_map> #include <cstring> #include <algorithm> using namespace std; typedef long long int64; typedef pair<int, int> ii; const int mod = 1e9 + 7; struct vec2 { int64 idx, val; }; class Solution { private: public: ...
413
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define all(v) ((v).begin()),((v).end()) #define ll long long #define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) double const EPS = 1e-9, PI = acos(-1); const int N = 2e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7; const...
353
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define P pair<int,int> #define fi first #define se second #define rep(i,n) for(int i=0;i<n;i++) #define all(v) v.begin(),v.end() #define pb push_back template<class T>void chmax(T &a,T b){if(a<b)a=b;} template<class T>void chmin(T...
727
Project_CodeNet
2,020
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
460
Project_CodeNet
2,020
#include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; #define eps 1e-8 #define eq(x,y) (fabs((x)-(y)) < eps) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int>pii; const int mod = 1e9+7; long double P...
463
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); template <typename T> inline void chkmax(T &x, T y)...
566
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=int(a);i<=int(b);++i) using namespace std; template<class A>void pr(A a){cout << (a) << endl;} template<class A,class B>void pr(A a,B b){cout << a << " " ;pr(b);} template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);} template<class A,cla...
632
Project_CodeNet
2,020
#include <iostream>//数据输入输出流 #include <cstring>//字符串操作函数 #include <cstdio>//C的输入输出 #include <cstdlib>//定义杂项函数及内存分配函数 #include <cmath>//C中的数学函数 #include <string>//c++中的string类 他不能用strcpy等c函数去操作 #include <vector>//STL vetor #include <list>//STL list #include <map>// STL map #include <queue>// STL queue #include <stack>//...
721
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; const ll MOD = 1000000007; ll dp[2010][2010]; void solve() { ll n; cin >> n; vector<pair<ll, ll>> a; for (ll i = 0; i < n; ++i) { ll x; cin >> x; a.push_back(make_pair(x, i));...
465
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; typedef long long ll; typedef pair<int,int>P; const int MOD=1000000007; const int INF=0x3f3f3f3f; const ll INFL=0x3f3f3f3f3f3f3f3f; int a[3000]; ll dp[3000][3000]; int main(){ int n;cin>>n; vector<P>v; rep(i,n){ scanf("%d",&a[i])...
284
Project_CodeNet
2,020
#include <iostream> #include <algorithm> #include <numeric> #include <vector> #include <functional> using lint = long long; template <class T> std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); } void solve() { int n; std::cin >> n; std::vector<lint> xs(n); for (auto& x : xs) std...
348
Project_CodeNet
2,020
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; typedef long long LL; const int N = 2010; pair<int, int> A[N]; LL dp[N][N]; LL solve(int idx, int l, int r) { if (l > r) return 0; if (dp[l][r] != -1) return dp[l][r]; LL res = max( 1LL * A[idx].f...
313
Project_CodeNet
2,020
#include <bits/stdc++.h> typedef long long ll; using namespace std; using Graph = vector<vector<int>>; int main() { int n; cin >> n; vector<pair<int,int>> p(n); for(int i = 0; i < n; i++) { int joy; cin >> joy; p.push_back(make_pair(joy, i)); } sort(p.rbegin(), p.rend()); ll dp[n+1][n+1]; ...
348
Project_CodeNet
2,020
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; typedef pair<ll,int> P; int n; vector<P> A; ll dp[2005][2005]; ll nex[2005][2005]; ll ans; int main() { cin >> n; for(int i = 0; i < n; i++) { ll a; cin >> a; A.push_back(P(a,i)); } sort(A....
493
Project_CodeNet
2,020
//****** @mdazmat9 ********** #include<bits/stdc++.h> using namespace std; #define int long long #define UB upper_bound #define LB lower_bound #define BS binary_search #define EB emplace_back #define PB push_back #define endl "\n" #define MOD 1000000007 #define MOD2 998244353 #define F first #define S second #define AL...
455
Project_CodeNet
2,020
#include "bits/stdc++.h" using namespace std; using ll = long long; int main(){ ll n; ll ans = -1; cin >> n; vector<pair<ll, ll> > v(n); for(int i = 0; i < n; i++){ int a; cin >> a; v[i] = make_pair(a, i); } sort(v.rbegin(), v.rend()); ll dp[n+1][n+1]; dp[0][...
339
Project_CodeNet
2,020
#include <bits/stdc++.h> #define int long long #define ld long double #define endl "\n" #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define pb(x) push_back(x) #define mp(a,b) make_pair(a,b) #define ms(v,x) memset(v,x,sizeof(v)) #define all(v) v.begin(),v.end() #define ff first #define ss second ...
506
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int N; vector<vector<long long>> dp; vector<P> A; long long dfs(int l, int r) { if (dp[l][r] != -1) return dp[l][r]; if (l == 0 && r == 0) return dp[l][r] = 0; long long res = -1; long long activeness = A[l + r - 1].first, idx = ...
376
Project_CodeNet
2,020
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; template<int MOD> struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v% MOD) { if (val < 0) val += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - ...
1,801
Project_CodeNet
2,020
#include<iostream> #include<algorithm> #include<string> #include<cstring> #include<queue> #include<stack> #include<deque> #include<map> #include<unordered_map> #include<set> #include<cmath> #include<random> //#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using...
835
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; typedef long long int lld; priority_queue<pair<lld,int> > q; lld dp[2222][2222]; int main(void){ int n; scanf("%d",&n); for(int e=1;e<=n;e++){ lld a; scanf("%lld",&a); q.push(make_pair(a,e)); } int num = 0; while(!q.empty()){ lld val = q.top().first; int w...
273
Project_CodeNet
2,020
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #...
402
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; int main(){ int n; cin >> n; vector<pair<ll, int>> a(n); rep(i,n) { cin >> a[i].first; a[i].second = i; } sort(a.begin(), a.end(), ...
311
Project_CodeNet
2,020
#include<bits/stdc++.h> typedef long long ll; typedef long double ld; #define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define PRECISION std::cout << std::fixed << std::setprecision(20); #define setzero(x) memset(x,0,sizeof(x)) using namespace std; const int inf = 2e9+500; const int ...
496
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(long long i=0; i<(n); i++) template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } in...
485
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using ll = long long; using PII = pair<ll, ll>; #define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template<typename T> void chmin(T &a, const T &b) { a = min(a, b); } template<typename T> void chmax(T &a, con...
393
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> as(n); vector<pair<long long, int>> tmp(n); for (int i = 0; i < n; ++i) { cin >> as[i]; tmp[i] = make_pair(as[i], i); } vector<int>...
313
Project_CodeNet
2,020
#include<iostream> #include<cmath> #include<algorithm> using namespace std; int n; struct dian { long long x; int id; }a[2010]; bool cmp(const dian &x,const dian &y) { return x.x>y.x; } long long f[2010][2010],ans; int main() { int i,j; cin>>n; for(i=1;i<=n;i++) { cin>>a[i].x;...
331
Project_CodeNet
2,020
/* #region Head */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; using vll = vc<ll>; using vvll = vvc<ll>; using vld = vc<ld>; usin...
1,904
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 2e3 + 5; ll dp[maxn][maxn]; struct Node { int seq, val; }a[maxn]; int cmp(Node a, Node b) { return a.val < b.val; } int main() { int len, n; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &a[...
313
Project_CodeNet
2,020
#include <bits/stdc++.h> #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod=1000000007; #define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll n; cin >> n...
253
Project_CodeNet
2,020
#include <iostream> #include <algorithm> #include <utility> #include <vector> #include <numeric> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (l...
725
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define ll long long const int mod=1e9+7; const int N=2e3+5; ll dp[N][N]; ll maxn; struct nobe{ ll v,p; }a[N]; bool cmp(nobe a,nobe b){ return a.v>b.v; } int main(){ ll n; cin>>n; for(ll i=0;i<n;i++){ cin>>a[i].v; a[i].p=i+1; } sort(a,a+n,cmp); for(ll i=0;i<=n;i+...
252
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back const ll mod = 1e9+7; const int N = 2020; ll dp[N][N]; ll pos[N]; ll val[N]; void solve(){ int n; cin>>n; vector<pair<int,int> > v; for(int i=1;i<=n;i++){ int x; cin>>x; ...
355
Project_CodeNet
2,020
#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i) #define FOR(i, s, n) for (int i = s; i < (int)n; ++i) #define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i) #define ALL(a) a.begin(), a.en...
1,384
Project_CodeNet
2,020
// E. #include <iostream> #include <sstream> #include <algorithm> #include <vector> using namespace std; typedef long long LL; int main(int argc, char* argv[]) { cout.precision(20); #ifdef _MSC_VER while (true) #endif { int n = -1; cin >> n; if (n < 0) return 0; vector<pair<LL, int>> v(n); for (int i = ...
350
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; using lnt = long long; using Real = long double; #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define REP(i, n) for(lnt i=0;i<(n);++i) #define RANGE(i, a, b) for(lnt i=(a);i<(b);++i) #define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i) ...
756
Project_CodeNet
2,020
#include<bits/stdc++.h> #define FOR(i,a,b) for(int i=a;i<=b;++i) using namespace std; const int mn=2006; int a[mn],id[mn]; long long f[mn][mn],ans; bool cmp(int x,int y) { return a[x]>a[y]; } int main() { int n; scanf("%d",&n); FOR(i,0,n-1) {scanf("%d",a+i);id[i]=i;} sort(id,id+n,cmp); FOR(i,0,n-1) FOR(j,0,n-i...
227
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define debug(x) cout<<#x<<"-"<<x<<"\n" #define time_assert(x) if(!(x))while(true) #define fi first #define se second #define int long long #define inf 1e16 const int mod=(int)1e9+7; int dp[2005][2005]; void test_case(){ int n; cin>>n; vector<pair<int,int> > arr(n);...
316
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; // Optimization //#pragma GCC optimize("O3") #define endl '\n' // Shortcut #define int long long #define eb emplace_back #define pb push_back #define pob pop_back #define mp make_pair #define upb upper_bound #define lwb lower_bound #define fi first #define se second #def...
1,105
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> P; const int INF = 1e9; int main() { ll n, ans = 0; cin >> n; vector<P> a(n); rep(i, n) cin >> a[i].first, a[i].second = i; sort(a.rbegin(), a.rend()); vector<vector<ll...
285
Project_CodeNet
2,020
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <numeric> #include <queue> #include <stack> #include <map> #include <set> #include <string> #include <functional> #include <list> #include <random> #include <time.h> #include <iomanip> #include <assert....
15,586
Project_CodeNet
2,020
/* @Killmonger """"" """""" """"""""" """"""""" """"" """""" """"""""""" """"""""""" """"" """""" """""""""""" """""""""""" """"" """""" """""" """""" ...
2,608
Project_CodeNet
2,020
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <iomanip> #include <map> #include <set> #include <tuple> #include <unordered_map> #include <iterator> #include <string> #include <limits> using namespace std; using i64 = int64_t; using P = pair<i64, i64>; i64 mod = ...
650
Project_CodeNet
2,020
#include <iostream> #include <cstdio> #include <cstring> #include <climits> #include <string> #include <algorithm> #include <cmath> #include <vector> #include <stack> #include <queue> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <sstream> #include <numeric> // # #include <boo...
644
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define inf LONG_LONG_MIN #define INF LONG_LONG_MAX #define forn(i,ii,n) for(int i=ii; i<=n; ++i) #define ford(i,n,ii) for(int i=n; i>=ii; --i) #define pb push_back #define eb ...
630
Project_CodeNet
2,020
#include <iostream> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #include <map> #include <algorithm> #include <iomanip> #include <math.h> #include <string.h> #include <cstdio> #include <tuple> using namespace std; using ll = long long; using pll = pair<ll, ll>; using vl = vector<...
840
Project_CodeNet
2,020
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<numeric> #include<cmath> #include<stdio.h> #include<stack> #include<math.h> #define rep(i,n) for(int i=0;i<(n);i++) #define Rep(i,n) for(int i=1;i<=(n);i++) #define LL long long int #define MOD 1000000007 using namespace std; LL l...
484
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < (n); ++i) using namespace std; template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } int main() { int N; cin >> N; vector<pair<int, int>> A(N); rep(i, N) { int a; cin >> a; A[i] = ma...
329
Project_CodeNet
2,020
#include<bits/stdc++.h> #define int long long #define double long double #define pb push_back #define ff first #define ss second #define PI acos(-1) #define bp __builtin_popcountll #define all(x) x.begin(),x.end() #define sp fixed<<setprecision #define pii pair<long long,long long> #define FAST ios_base::sync_with_stdi...
335
Project_CodeNet
2,020
#include "bits/stdc++.h" using namespace std; const int N=2e3+20; int n,x; vector <pair <int,int>> v; long long dp[N][N]; long long f(int l,int r) { long long &ans=dp[l][r]; if(ans!=-1) return ans; int i=l+(n-1-r); // total i elements have been assigned position int old_pos=v[i].second; if(l==r) return ans=v[i...
262
Project_CodeNet
2,020
#pragma GCC optimize("O3", "unroll-loops") //#pragma GCC target("avx2") #pragma GCC target ("sse4") #pragma optimize("fast-math") #include <bits/stdc++.h> #include <stdio.h> using namespace std; #define endl '\n' #define ull unsigned long long #define si short int #define ll long long #define ld long double #define p...
672
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 2e3 + 3; int dp[N][N], p[N], A[N]; bool cmp(int i, int j) {return A[i] > A[j];} int32_t main() { int n, ans = 0; cin >> n; for (int i = 1; i <= n; i++) cin >> A[i], p[i] = i; sort(p + 1, p + n + 1, cmp); for (int i = 0; ...
275
Project_CodeNet
2,020
#include "bits/stdc++.h" #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll =long long; using P =pair<int,int>; int main(){ ll n; cin >> n; vector <ll> a(n); vector <vector <ll>> a2(n,vector <ll> (2)); rep(i,n){ cin >> a[i]; a2[i][0]=a[i]; a2[i][1]=i+1...
478
Project_CodeNet
2,020
/*author : Yashvardhan Sunday, April 19, 2020 7:49 PM */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define pb push_back #define vi vector<int> #define pi pair<int,int> #define vpi vector<pi> #define ff first #define ss second #define mp make_pair #define endl '\n' #define all...
966
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define SZ(x) ((int)x.size()) #define ALL(x) (x).begin(),(x).end() #define lowbit(x) x&-x #define pb emplace_back #define ls (id<<1) #define rs (id<<1|1) #define Rint register int #define UNI(x) sort(ALL(x)),x.resize(unique(ALL(x))-x.begin(...
594
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) using P = pair<long long,int>; int n, a; long long dp[2005][2005], ans; P p[2005]; int main(){ scanf("%d", &n); rep(i,n){ scanf("%d", &a); p[i] = P{a, i}; } sort(p, p+n, greater<P>()); for(int i=1; i<=n; i++) for(int j=0; j...
231
Project_CodeNet
2,020
#include <bits/stdc++.h> #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = (a); i < (b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define ALL(x) x.begin(), x.end() #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = m...
535
Project_CodeNet
2,020
#include <bits/stdc++.h> #define Int int64_t using namespace std; void chmax(Int& a, Int b) { if (a < b) { a = b; } }; int main() { int N; cin >> N; vector<pair<Int, Int>> ai(N); for (int i = 0; i < N; ++i) { int a; cin >> a; ai[i] = { a, i }; } sort(ai.rbegin(), ai.rend()); vector<vector<Int>> dp(N + ...
324
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int,int> #define ff first #define ss second const int N = 2001; int dp[N][N]; int n; pi a[N]; int solve(int l,int r){ if(l+r>=n) return 0; int &tmp = dp[l][r]; if(tmp != -1) return tmp; tmp = solve(l+1,r)+abs(l+1-a[l+r+1].ss)*...
224
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define ll long long #define lf long double #define pb push_back #define mp make_pair #define F first #define S second typedef pair <ll,ll> ii; typedef vector <ll> vi; typedef vector <ii> vii; typedef vector <bool> vb; typedef vector <vector <ll> > vv; typedef vector <vect...
647
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using int64 = long long; const int mod = 998244353; const int64 infll = (1LL << 60) - 1; const int inf = (1 << 30) - 1; struct IoSetup { IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); cerr << fixed << setp...
913
Project_CodeNet
2,020
//#include <bits/stdc++.h> #include "bits/stdc++.h" using namespace std; typedef long long ll; #include "boost/multiprecision/cpp_int.hpp" #include "boost/multiprecision/cpp_dec_float.hpp" namespace mp = boost::multiprecision; typedef mp::cpp_int LL; typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点...
827
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<(n); i++) using ll = long long; const ll mod = 1e9 + 7; int main(){ int n; cin >> n; vector<pair<ll, int>> p(n); vector<int> y(n); rep(i, n){ cin >> p[i].first; p[i].second = i + 1; y[i] = i + 1; } sort(p.begin(),...
414
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define Rep(i,n) for(int i=1;i<=(n);++i) using LL = long long; using ULL = unsigned long long; LL dp[2001][2001]; int main() { int n, a; cin >> n; vector<pair<int, int>> x; Rep(i, n) cin >> a, x.emplace_back(a, i); sort(x.begin(...
297
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defin...
592
Project_CodeNet
2,020
#include <iostream> #include <vector> #include <string> #include <map> #include <set> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<ll> vi; #define forn(i, n) for (int (i) = 0; (i) != (n); (i)++) #define all(v) (v...
635
Project_CodeNet
2,020
#include <string> #include <iostream> #include <stack> #include <queue> // priority_queue も入ってる #include <set> // 要素数は size() で取得 #include <map> #include <array> // sizeはコンパイル時定数で固定 #include <vector> #include <numeric> // accumulate, gcd #include <algorithm> // count_ifに必要 #include <iomanip> // cout << setprecisi...
814