QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90129 | #48. Paint bucket | ChatGPT | 5 | 2ms | 3324kb | C++ | 1.1kb | 2023-03-22 13:35:54 | 2023-03-22 13:35:58 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
void fill(vector<vector<int>>& pixels, int y, int x, int target_color, int new_color) {
if (y < 0 || y >= pixels.size() || x < 0 || x >= pixels[0].size()) {
// out of bounds
return;
}
if (pixels[y][x] != target_color) {
// not the target color
return;
}
pixels[y][x] = new_color;
fill(pixels, y-1, x, target_color, new_color); // up
fill(pixels, y+1, x, target_color, new_color); // down
fill(pixels, y, x-1, target_color, new_color); // left
fill(pixels, y, x+1, target_color, new_color); // right
}
int main() {
int R, C, Y, X, K;
cin >> R >> C;
vector<vector<int>> pixels(R, vector<int>(C));
for (int i = 0; i < R; i++) {
for (int j = 0; j < C; j++) {
cin >> pixels[i][j];
}
}
cin >> Y >> X >> K;
fill(pixels, Y, X, pixels[Y][X], K);
for (int i = 0; i < R; i++) {
for (int j = 0; j < C; j++) {
cout << pixels[i][j];
}
cout << endl;
}
return 0;
}
详细
Test #1:
score: 2.5
Accepted
time: 2ms
memory: 3324kb
input:
1 1 0 0 0 2
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Runtime Error
input:
1 999 010000122000221212000001102122211002021202201110221220121222121222002201000022112022221100201011120001120222011111202102200122021122000201102120112000111220210100222022001010222211100202002001000000010122201010210200200201200111011010021221202001002001022101101221110120110102112120122201100102...
output:
result:
Test #3:
score: 0
Runtime Error
input:
999 999 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
result:
Test #4:
score: 0
Runtime Error
input:
999 999 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
result:
Test #5:
score: 0
Runtime Error
input:
999 999 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
result:
Test #6:
score: 0
Runtime Error
input:
100 100 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 333333333333333333333333333333333333333333333333333333333333333333333333333333333333300000...
output:
result:
Test #7:
score: 0
Runtime Error
input:
10 10 0000000000 0000000000 0000000000 0002222222 0002222222 0002222222 0002222222 0002222222 0002222222 0000000000 4 3 8
output:
result:
Test #8:
score: 0
Runtime Error
input:
37 41 00000000000000000000000000000000000000000 00003333332222222000000000000000000000000 00003333332222222400000000000000000000000 00003333332222222400000000000000000000000 00000000002222222000000000000000000000000 01111000002222222000000000000000000000000 01111000002222222000000000000000000000000 ...
output:
result:
Test #9:
score: 0
Runtime Error
input:
101 23 00000000000000000000000 00000000000000000000000 00000000000000000000000 00550000000000000000000 00550000000000000000000 00550000000000666666666 00000000000000666666666 00000000000033666666666 00000000000033666666666 00000000000033666666666 00000000000033666666666 00000000000033666666666 00000...
output:
result:
Test #10:
score: 0
Runtime Error
input:
99 99 000111111111111111111110000000222222222200000000000002222222222111111111111111111111111111110000000 000111111111111111111100000000222222222200000000000002222222222222222222211111111111111111110000000 0000000000000000000000000000000000000000000000000000022222222222222222222000000000000000000000...
output:
result:
Test #11:
score: 0
Runtime Error
input:
999 999 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
result:
Test #12:
score: 0
Runtime Error
input:
2 2 00 00 0 0 5
output:
result:
Test #13:
score: 0
Runtime Error
input:
10 10 0020000000 0020000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 7 0 5
output:
result:
Test #14:
score: 0
Runtime Error
input:
10 10 1011010001 1101110010 1011100101 0001000100 0111011101 1001000011 0010010001 1100011010 1111100001 1001100101 8 3 7
output:
result:
Test #15:
score: 0
Runtime Error
input:
21 65 53873158858286810870176106345173356164277260627250400116142607473 27075625183001565241815216181888478050730021534875841303440033518 08761068463150458850738731138707225402731227022768273187218146148 16748553628015267853255506114766877231568434030472746027364517746 120268284583202745273370710488...
output:
result:
Test #16:
score: 0
Runtime Error
input:
104 45 120020241403220040303340432212140042344032432 004300330012014000004342411431102432030104330 100211122100444014411042001403011420422233230 220330221321210222304124044312223321344401243 330103003204322341103132032400244434203021143 143204420100200312123233334212021340241103432 10131002041432341...
output:
result:
Test #17:
score: 0
Runtime Error
input:
509 499 0210202211011022112122102111011221020001102212212020221011221111000101112222222201210120012010202222201211002000001220122112111101122200202021020000110111121222120210212111022211001002110010110121212010000001200021210020000002110101220022212120011220211012201020120120210202001110211012201000...
output:
result:
Test #18:
score: 0
Runtime Error
input:
999 999 0111110101100100011011111000010111110000101100101101110000011111110101000010010010010110011111110011000101110110000010111100010010010110101100011100101011100001110100010010001100101111010100100101001111000001000101110111110000011011010010011111100100100001101010011011010011010100010101111100...
output:
result:
Test #19:
score: 0
Runtime Error
input:
999 999 1011100101111110101001111011000101011010101001000110100110101011011010000100010001001001001101010110100010100011011110111011000010000111010101000010111100100101111001001110010010011000111110010100100011011101000001001001011101010100011010011000010000111111010111011001111100100111101011111011...
output:
result:
Test #20:
score: 2.5
Accepted
time: 1ms
memory: 3316kb
input:
99 1 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 1 21 0 5
output:
1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 5 5 5 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 1
result:
ok 99 lines