Submission #14234689
Source Code Expand
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<iostream>
#include<set>
#include<map>
using namespace std;
#define mp make_pair
#define ll long long
#define re register
typedef pair<int,int> pii;
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline ll gi()
{
ll f=1,sum=0;char ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
return f*sum;
}
const int N=200010;
int n=gi(),k=gi();
int A[N],ret[N];
bool check()
{
for(int i=1;i<=n;i++)if(A[i]!=n)return true;
return false;
}
int main()
{
for(int i=1;i<=n;i++)A[i]=gi();
while(k--&&check())
{
for(int i=1;i<=n;i++)
{
ret[i]=1;
for(int j=1;j<=n;j++)
if(i!=j)if((i<j&&j-A[j]<=i)||(i>j&&j+A[j]>=i))ret[i]++;
}
for(int i=1;i<=n;i++)A[i]=ret[i];
}
for(int i=1;i<=n;i++)printf("%d%c",A[i]," \n"[i==n]);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Lamps |
| User | FIce |
| Language | C++ (GCC 9.2.1) |
| Score | 0 |
| Code Size | 1014 Byte |
| Status | TLE |
| Exec Time | 2205 ms |
| Memory | 4432 KiB |
Judge Result
| Set Name | $Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 500 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| $Sample | sample01.txt, sample02.txt |
| All | sample01.txt, sample02.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, sample01.txt, sample02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| in01.txt | AC | 32 ms | 4432 KiB |
| in02.txt | TLE | 2205 ms | 4020 KiB |
| in03.txt | TLE | 2205 ms | 3892 KiB |
| in04.txt | TLE | 2205 ms | 4100 KiB |
| in05.txt | TLE | 2205 ms | 3828 KiB |
| in06.txt | TLE | 2205 ms | 4064 KiB |
| in07.txt | TLE | 2205 ms | 3932 KiB |
| in08.txt | TLE | 2205 ms | 4036 KiB |
| in09.txt | TLE | 2205 ms | 3952 KiB |
| in10.txt | TLE | 2205 ms | 3880 KiB |
| in11.txt | TLE | 2205 ms | 4020 KiB |
| in12.txt | TLE | 2205 ms | 3920 KiB |
| in13.txt | TLE | 2205 ms | 3976 KiB |
| in14.txt | TLE | 2205 ms | 3984 KiB |
| in15.txt | TLE | 2205 ms | 3980 KiB |
| in16.txt | TLE | 2205 ms | 4112 KiB |
| in17.txt | TLE | 2205 ms | 4044 KiB |
| in18.txt | TLE | 2205 ms | 4004 KiB |
| in19.txt | TLE | 2205 ms | 3988 KiB |
| sample01.txt | AC | 2 ms | 3700 KiB |
| sample02.txt | AC | 2 ms | 3520 KiB |