Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | WA18 hint | andreyDagger | 1498. Удар с разбега | 6 июн 2022 19:30 | 1 | Knight can't step on the cell with the horned demon | WA #23 | Neralu | 1498. Удар с разбега | 8 мар 2021 00:05 | 1 | WA #23 Neralu 8 мар 2021 00:05 I've already run throw every test i've found here and some that I thpught myself. I dont understand what is test #23. Can someone post some test to run? Edited by author 08.03.2021 04:25 Edited by author 25.03.2021 12:41 | help!!! | Dembel {AESC USU} | 1498. Удар с разбега | 20 июл 2019 19:50 | 2 | help!!! Dembel {AESC USU} 19 окт 2006 18:34 Input 3 3 1 1 1 3 3 Output 0 is it correct? Re: help!!! 👨🏻💻 Spatarel Dan Constantin 20 июл 2019 19:50 I think so. My AC solution outputs 0. It should be noted that the problem statement doesn't mention what happens if you can't get next to the demon in at most L moves. Either such a test is invalid or you should output 0, since you can't stike it, thus you give it a stike of at most 0 intensity. | WA 5 | Mohit Kumar Basak | 1498. Удар с разбега | 18 окт 2018 21:30 | 1 | WA 5 Mohit Kumar Basak 18 окт 2018 21:30 Here's my code- #include <bits/stdc++.h> using namespace std; bool upp,downn,leftt,rightt,avleftt,avrightt,avupp,avdownn; bool vis[105][105],vis2[105][105]; int dist[105][105]; int dist2[105][105]; int xmov[4]={0,-1,0,1}; int ymov[4]={-1,0,1,0}; int main() { // cout << "Hello World!" << endl; ios::sync_with_stdio(false); for(int i=1;i<105;i++)for(int j=1;j<105;j++)dist[i][j]=INT_MAX; int n,m,l,x1,y1,x2,y2; cin>>n>>m>>l; cin>>x1>>y1; cin>>x2>>y2;
queue <pair <int,int> > q; queue <int> distt; int ans=0; if(abs(x1-x2)+abs(y1-y2)==1){ ans=1; } vis[x1][y1]=true; dist[x1][y1]=0; vis[x2][y2]=true; q.push(make_pair(x1,y1)); distt.push(0);
while(q.empty()==0){ pair <int,int> topp=q.front(); int curdist=distt.front(); q.pop(); distt.pop(); int curx,cury,nextx,nexty; curx=topp.first; cury=topp.second; for(int i=0;i<4;i++){ nextx=curx+xmov[i]; nexty=cury+ymov[i]; if(nextx>=1&&nextx<=n&&nexty>=1&&nexty<=m){
if(vis[nextx][nexty]==false){ vis[nextx][nexty]=true; q.push(make_pair(nextx,nexty)); distt.push(curdist+1); dist[nextx][nexty]=curdist+1; } } } }
q.push(make_pair(x2,y2)); distt.push(-1); vis2[x2][y2]=true; dist2[x2][y1]=-1; while(q.empty()==0){ pair <int,int> topp=q.front(); int curdist=distt.front(); q.pop(); distt.pop(); int curx,cury,nextx,nexty; curx=topp.first; cury=topp.second; for(int i=0;i<4;i++){ nextx=curx+xmov[i]; nexty=cury+ymov[i]; if(nextx>=1&&nextx<=n&&nexty>=1&&nexty<=m){
if(vis2[nextx][nexty]==false){ vis2[nextx][nexty]=true; q.push(make_pair(nextx,nexty)); distt.push(curdist+1); dist2[nextx][nexty]=curdist+1; } } } }
for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(i==x2&&j==y2){ continue; }
if(dist[i][j]!=INT_MAX){ cout<<i<<" ::::: "<<j<<"\n"; int totaldist=dist[i][j]+dist2[i][j]; if(totaldist<=l){ ans=max(ans,max(abs(y2-j),abs(x2-i))+1); } }
} }
cout<<ans; return 0; } | Question on subject | Semm | 1498. Удар с разбега | 5 июл 2016 17:04 | 2 | Can the knight run back and forward on the segment? Does it count as run up? Example: The monster is at (1,3), the knight is at (1,1) If the knight does (1,1) -> (1,2) -> (1,1) -> (1,2) -> Strike the strike force is 4 or 2? Thanks in advance | WA 18 | _I_ | 1498. Удар с разбега | 7 дек 2011 14:09 | 8 | WA 18 _I_ 28 окт 2006 12:54 please give test case! i checked all test case which came to my mind. thanks Try this. I used my AC 6 1 8 6 1 5 1 ans 1 6 1 6 4 1 5 1 ans 4 6 2 8 6 2 5 2 ans 4 6 2 10 6 2 5 2 ans 5 Thanks a lot. I forgot about singular cases and had WA #13. why 6 1 6 4 1 5 1 ans 4? we go to the cell(1,1) (3 moves) and then to the cell(4,1) (3 moves) and hit. k=4 so ans is 5. what's wrong? Edited by author 01.04.2010 02:00 Re: WA 18 Oleg Strekalovsky [Vologda SPU] 21 июл 2010 21:04 hit is not a step. 3 steps to adjacent cell with monster Then why the answer for the sample test 3 4 4 1 1 3 4 is 4 ?? According with your explanation it should be 3, instead 4 Easy problem but difficult language !! Sorry, it was my mistake, your explanation is correct | WA8 | nikenny | 1498. Удар с разбега | 8 янв 2010 02:09 | 1 | WA8 nikenny 8 янв 2010 02:09 Please, gimme some tests equal test8 Edited by author 08.01.2010 02:59 | No subject | TEST | 1498. Удар с разбега | 20 май 2009 14:24 | 1 | now i have AC! Edited by author 25.05.2009 11:45 | 3 WAs before AC | Denis Koshman | 1498. Удар с разбега | 12 авг 2008 10:45 | 1 | | Please, give me some tests to check my program. I have WA#3. HELP! | Alexey | 1498. Удар с разбега | 12 авг 2008 10:44 | 4 | I had WA3 when I used 'l' as temporary variable for one of the loops | WA 21 | Jony Inglish | 1498. Удар с разбега | 17 май 2007 21:44 | 3 | WA 21 Jony Inglish 8 май 2007 17:41 Please, give me some tests on #21 Please, give me some examples! I don't now why I get WA on test #21... Re: WA 21 {AESC USU} Evgeny Kurpilyanskij 17 май 2007 21:44 try this test 5 7 10 2 2 3 7 Ans: 7. | Help me! I got WA14 | Dembel {AESC USU} | 1498. Удар с разбега | 19 окт 2006 18:55 | 1 | | I am too stupid to dolve this problem... | Alexander Sokolov [MAI] | 1498. Удар с разбега | 19 окт 2006 01:31 | 1 | I understood my mistake Edited by author 19.10.2006 02:40 |
|
|