| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1027221 | thdh__ | Binaria (CCO23_day1problem1) | C++17 | 0 ms | 2516 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define pb push_back
#define eb emplace_back
#define pu push
#define ins insert
#define bruh ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff(x,a,b,c) for (auto x=a;x<=b;x+=c)
#define fd(x,a,b,c) for (auto x=a;x>=b;x-=c)
#define int ll
using namespace std;
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int, int> ii;
const int N = 2e5+5;
const int mod = 1e6+3;
const int INF = 1e18;
using cd = complex<double>;
const long double PI = acos(-1);
int power(int a,int b) {ll x = 1;if (a >= mod) a%=mod; while (b) {if (b & 1) x = x*a % mod;a = a*a % mod;b>>=1;}return x;}
int n,k;
int p[N],gt[N];
void solve()
{
cin>>n>>k;
for (int i=1;i<=n-k+1;i++) cin>>p[i];
int m = n-k+1;
for (int i=1;i<n-k+1;i++)
{
if (abs(p[i]-p[i+1])>1)
{
cout<<0; return;
}
}
int cnt = 0,cnt1 = 0;
for (int i=2;i<=min(k,n-k+1);i++)
{
if (p[i]==(p[i-1] + 1)) //so o vi tri i-1 phai = 1
{
cnt++;
} else if ((p[i]+1)==p[i-1]) //so o vi tri i-1 phai la 0
{
cnt++; cnt1++;
}
}
//cout<<cnt<<" "<<endl;
int needed1 = p[1]-cnt1;
//cout<<needed1<<endl;
gt[0] = 1;
for (int i=1;i<=k;i++) gt[i] = gt[i-1] * i;
cout<<gt[k-cnt]/(gt[k-cnt-needed1] * gt[needed1]);
}
signed main()
{
bruh
//freopen("input.inp","r",stdin);
//freopen("output.inp","w",stdout);
int t = 1;
//cin>>t;
while (t--)
{
solve();
cout<<"\n";
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
