QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#663905#7866. TeleportationTheShuMoWA 1ms7656kbC++142.0kb2024-10-21 18:18:022024-10-21 18:18:03

Judging History

你现在查看的是最新测评结果

  • [2024-10-21 18:18:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7656kb
  • [2024-10-21 18:18:02]
  • 提交

answer

#include<bits/stdc++.h>
#define fo(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define rep(i,l,r) for(ll i(l),i##end(r);i<=i##end;++i)
#define per(i,r,l) for(ll i(r),i##end(l);i>=i##end;--i)
#define dbg(x) cerr<<#x<<" "<<x<<'\n';
#define ll long long
#define gc getchar
#define pc putchar
using namespace std;
namespace WrongIO
{
	#define Ts template<typename Ty,typename... Ar>
	#define Tp template<typename Ty>
	Tp Ty wmax(Ty a,Ty b){return a>=b? a:b;}
	Tp Ty wmin(Ty a,Ty b){return a<=b? a:b;}
	Tp void read(Ty &x){x=0;Ty opt=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();if(c=='-')opt=-1,c=gc();while(isdigit(c))x=(x<<3)+(x<<1),x+=c-'0',c=gc();x*=opt;return;}
	Tp void write(Ty x){short OI_USE[150],OI_top=0;if(x<=0) if(x==0)pc('0');else pc('-'),x*=-1;while(x)OI_USE[++OI_top]=x%10,x/=10;while(OI_top--)pc(OI_USE[OI_top+1]+'0');return;}
    void writec(char c[]){int len=strlen(c);for(int i=0;i<len;i++)pc(c[i]);}
    void writes(string s){int len=s.length();for(int i=0;i<len;i++)pc(s[i]);}
    void readc(char &c,int l,int r){c=gc(); while(c!=EOF&&(c<l||c>r)) c=gc();}
    void readc(char &c,char val){c=gc();while(c!=EOF&&c!=val) c=gc();}
    void readc(char val){char c;c=gc();while(c!=EOF&&c!=val) c=gc();}
    void readls(string &s){char c=gc();while(c!='\n') s.push_back(c),c=gc();}
    Ts void read(Ty &x,Ar &...y) {read(x),read(y...);}
    Tp void writeln(Ty x) {write(x),pc('\n');}
    Tp void writesp(Ty x) {write(x),pc(' ');} 
    #undef Ts
	#undef Tp
} using namespace WrongIO;
ll val[200050],a[200050],n,ed;
queue<ll> q;
struct awa{
	ll ps,id;
};
bool cmp(awa a,awa b)
{
	return a.ps>b.ps;
}
awa e[200050];
int main()
{
	read(n,ed); ed++;
	rep(i,1,n)
	{
		val[i]=1e9;
		read(a[i]);
		if(i<=ed)
		e[i]=awa{i+a[i],i};
	}
	n=ed;
	sort(e+1,e+n+1,cmp);
	ll minx=1e9,idq=n;
	rep(i,1,n)
	{
		if(e[i].ps>n)
		{
			val[e[i].id]=n-e[i].id;
			continue;
		}
		while(idq>=e[i].ps) ++minx,minx=min(minx,val[idq]),idq--;
		val[e[i].id]=1+min(minx+1,n-e[i].ps);
	}
	write(val[1]);
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5708kb

input:

4 3
0 1 2 3

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 7656kb

input:

4 3
0 0 0 0

output:

4

result:

ok 1 number(s): "4"

Test #3:

score: 0
Accepted
time: 1ms
memory: 5672kb

input:

4 3
2 2 2 2

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 0ms
memory: 7652kb

input:

2 1
0 0

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 1ms
memory: 7656kb

input:

2 1
1 1

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 5876kb

input:

300 25
182 9 13 211 258 132 27 42 218 200 271 258 164 121 8 84 29 195 141 290 110 0 272 93 142 134 140 32 232 99 162 199 297 287 212 29 182 53 61 98 116 282 75 245 230 165 22 4 179 89 274 231 46 299 248 208 200 285 221 50 221 199 294 241 195 138 22 204 113 100 132 276 158 146 238 178 100 94 131 157 ...

output:

25

result:

wrong answer 1st numbers differ - expected: '10', found: '25'