| Task: | Ratsun reitit |
| Sender: | Juho |
| Submission time: | 2020-09-28 15:50:48 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 27 |
| #2 | ACCEPTED | 31 |
| #3 | ACCEPTED | 42 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #2 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #3 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #4 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #5 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #6 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #7 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #8 | ACCEPTED | 0.01 s | 2, 3 | details |
| #9 | ACCEPTED | 0.01 s | 2, 3 | details |
| #10 | ACCEPTED | 0.01 s | 2, 3 | details |
| #11 | ACCEPTED | 0.01 s | 3 | details |
| #12 | ACCEPTED | 0.01 s | 3 | details |
| #13 | ACCEPTED | 0.01 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:20:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<v.size(); i++){
~^~~~~~~~~Code
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> v, w;
int x,y,n;
int main(){
cin>>n;
int t[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
t[i][j]=1000000;
}
}
int maara = n*n;
t[0][0] =0;
maara--;
v.push_back({0,0});
int indeksi = 1;
while(maara>0){
for(int i=0; i<v.size(); i++){
x = v[i].first;
y = v[i].second;
if(0<=x+1&&x+1<n&&0<=y+2&&y+2<n){
if(t[x+1][y+2]==1000000){
maara--;
w.push_back({x+1,y+2});
t[x+1][y+2]=indeksi;
}
}
if(0<=x-1&&x-1<n&&0<=y+2&&y+2<n){
if(t[x-1][y+2]==1000000){
maara--;
w.push_back({x-1,y+2});
t[x-1][y+2]=indeksi;
}
}
if(0<=x-1&&x-1<n&&0<=y-2&&y-2<n){
if(t[x-1][y-2]==1000000){
maara--;
w.push_back({x-1,y-2});
t[x-1][y-2]=indeksi;
}
}
if(0<=x+1&&x+1<n&&0<=y-2&&y-2<n){
if(t[x+1][y-2]==1000000){
maara--;
w.push_back({x+1,y-2});
t[x+1][y-2]=indeksi;
}
}
if(0<=x+2&&x+2<n&&0<=y+1&&y+1<n){
if(t[x+2][y+1]==1000000){
maara--;
w.push_back({x+2,y+1});
t[x+2][y+1]=indeksi;
}
}
if(0<=x-2&&x-2<n&&0<=y+1&&y+1<n){
if(t[x-2][y+1]==1000000){
maara--;
w.push_back({x-2,y+1});
t[x-2][y+1]=indeksi;
}
}
if(0<=x+2&&x+2<n&&0<=y-1&&y-1<n){
if(t[x+2][y-1]==1000000){
maara--;
w.push_back({x+2,y-1});
t[x+2][y-1]=indeksi;
}
}
if(0<=x-2&&x-2<n&&0<=y-1&&y-1<n){
if(t[x-2][y-1]==1000000){
maara--;
w.push_back({x-2,y-1});
t[x-2][y-1]=indeksi;
}
}
}
indeksi++;
v.clear();
v=w;
w.clear();
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<t[i][j]<<" ";
}
cout<<"\n";
}
}
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
| user output |
|---|
| 0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
Test 2
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 5 |
| correct output |
|---|
| 0 3 2 3 2 3 4 1 2 3 2 1 4 3 2 3 2 3 2 3 2 3 2 3 4 |
| user output |
|---|
| 0 3 2 3 2 3 4 1 2 3 2 1 4 3 2 3 2 3 2 3 2 3 2 3 4 |
Test 3
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 6 |
| correct output |
|---|
| 0 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 3 2 3 2 3 4 2 3 2 3 4 3 ... |
| user output |
|---|
| 0 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 3 2 3 2 3 4 2 3 2 3 4 3 ... |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 7 |
| correct output |
|---|
| 0 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 3 2 3 2 3 4 3 2 3 2 3 4 3 4 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 3 2 3 2 3 4 3 2 3 2 3 4 3 4 ... Truncated |
Test 5
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 8 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 3 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 3 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... Truncated |
Test 6
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 9 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 3 4 1 2 3 4 3 4 5 2 1 4 3 2 3 4 5 4 3 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 5 4 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 3 4 1 2 3 4 3 4 5 2 1 4 3 2 3 4 5 4 3 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 ... Truncated |
Test 7
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 10 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 3 4 1 2 3 4 3 4 5 6 2 1 4 3 2 3 4 5 4 5 3 2 3 2 3 4 3 4 5 6 2 3 2 3 4 3 4 5 4 5 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 3 4 1 2 3 4 3 4 5 6 2 1 4 3 2 3 4 5 4 5 3 2 3 2 3 4 3 4 5 6 2 3 2 ... Truncated |
Test 8
Group: 2, 3
Verdict: ACCEPTED
| input |
|---|
| 25 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 9
Group: 2, 3
Verdict: ACCEPTED
| input |
|---|
| 49 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 10
Group: 2, 3
Verdict: ACCEPTED
| input |
|---|
| 50 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 11
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 75 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 12
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 99 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
Test 13
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 100 |
| correct output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
| user output |
|---|
| 0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... Truncated |
