QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294222#4826. Find the Partsucup_team_qiuly#0 1ms3744kbC++143.0kb2023-12-30 10:19:212023-12-30 10:19:22

Judging History

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

  • [2023-12-30 10:19:22]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3744kb
  • [2023-12-30 10:19:21]
  • 提交

answer

//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(...) fprintf (stderr, __VA_ARGS__)

#define lep(i, l, r) for (int i = (l), i##_end = (r); i <= i##_end; ++ i)
#define rep(i, r, l) for (int i = (r), i##_end = (l); i >= i##_end; -- i)

char _c; bool _f; template <class T> inline void IN (T & x) {
	_f = 0, x = 0; while (_c = getchar (), ! isdigit (_c)) if (_c == '-') _f = 1;
	while (isdigit (_c)) x = x * 10 + _c - '0', _c = getchar (); if (_f == 1) x = -x;
}

template <class T> inline void chkmin (T & x, T y) { if (x > y) x = y; }
template <class T> inline void chkmax (T & x, T y) { if (x < y) x = y; }

signed main () {
	string str; cin >> str;
	auto tr = [&] (char c) {
		return isdigit (c) ? c - '0' : 10 + c - 'A';
	};
	auto rt = [&] (int u) {
		return u < 10 ? u + '0' : u - 10 + 'A';
	};
	if (str[0] == 'm') {
		int n, m;
		IN (n), IN (m);
		vector <vector <int> > mp (n, vector <int> (m, 0));
		lep (i, 0, n - 1) lep (j, 0, m - 1) {
			cin >> str;
			assert (str.length () == 2);
			mp[i][j] = tr (str[0]) * 16 + tr (str[1]);
		}
		vector <char> out;
		out.emplace_back (rt ((n / 256) / 16));
		out.emplace_back (rt ((n / 256) & 15));
		out.emplace_back (rt ((n & 255) / 16));
		out.emplace_back (rt ((n & 255) & 15));
		out.emplace_back (rt ((m / 256) / 16));
		out.emplace_back (rt ((m / 256) & 15));
		out.emplace_back (rt ((m & 255) / 16));
		out.emplace_back (rt ((m & 255) & 15));

		lep (i, 0, n - 2) if (! (i % 9)) {
			lep (j, 0, m - 3) if (! (j % 8)) {
				lep (x, 0, 1) lep (y, 0, 2) {
					out.emplace_back (rt (mp[i + x][j + y] / 16));
					out.emplace_back (rt (mp[i + x][j + y] & 15));
				}
			}
		}

		cout << out.size () / 2 << endl;
		for (int i = 0, s = out.size (); i < s; i += 2) {
			cout << out[i] << out[i + 1] << " " ;
		}
		cout << endl;
	} else {
		int X; IN (X);
		map <vector <char>, int> spe;

		int n = 0, m = 0;
		lep (i, 0, 1) cin >> str, n = n * 256 + tr (str[0]) * 16 + tr (str[1]);
		lep (i, 0, 1) cin >> str, m = m * 256 + tr (str[0]) * 16 + tr (str[1]);

		lep (i, 0, n - 2) if (! (i % 9)) {
			lep (j, 0, m - 3) if (! (j % 8)) {
				vector <char> key;
				lep (x, 0, 1) lep (y, 0, 2) {
					cin >> str;
					key.emplace_back ( str[0] );
					key.emplace_back ( str[1] );
				}
				spe[key] = (i << 13) | j;
			}
		}

		int q; IN (q); while (q -- ) {
			int x, y; IN (x), IN (y);
			vector <vector <int> > mp (x, vector <int> (y, 0));
			lep (i, 0, x - 1) lep (j, 0, y - 1) {
				cin >> str;
				assert (str.length () == 2);
				mp[i][j] = tr (str[0]) * 16 + tr (str[1]);
			}
			lep (i, 0, x - 2) lep (j, 0, y - 3) {
				vector <char> key;
				lep (a, 0, 1) lep (b, 0, 2) {
					key.emplace_back ( rt (mp[i + a][j + b] / 16) );
					key.emplace_back ( rt (mp[i + a][j + b] & 15) );
				}
				if (spe.count (key)) {
					int u = spe[key];
					cout << (u >> 13) - i + 1 << " " << (u & 8191) - j + 1 << endl;
					break ;
				}
			}
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

message
20 24
33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81
86 3E 23 7B C9 38 77 82 7D 62 EA CE A8 DE 85 6C 36 B3 10 EE 85 6A D5 92
14 BD 58 74 20 7B 36 E1 89 B8 6F 4A F4 8F 17 2E 2F 0F 79 DD AA 9F 6F AD
85 21 B6 2F 58 37 87 7B 3F EE D9 7D 9A E6 AA 12 E0 B6 BB 3D 72 BD 34 A...

output:

58
00 14 00 18 33 39 73 86 3E 23 96 4B 0B 7D 62 EA B0 6E DC 36 B3 10 7B 44 57 EC C9 BE 03 E3 60 61 5C 66 59 0E 99 11 0D 19 5F 04 CB C1 C4 8B 96 27 35 06 42 07 44 15 14 B2 08 96 

input:

parts
58
00 14 00 18 33 39 73 86 3E 23 96 4B 0B 7D 62 EA B0 6E DC 36 B3 10 7B 44 57 EC C9 BE 03 E3 60 61 5C 66 59 0E 99 11 0D 19 5F 04 CB C1 C4 8B 96 27 35 06 42 07 44 15 14 B2 08 96
2
10 10
39 73 4A 5A AA E0 86 96 4B 0B
3E 23 7B C9 38 77 82 7D 62 EA
BD 58 74 20 7B 36 E1 89 B8 6F
21 B6 2F 58 37 87 7...

output:

1 2
6 5

result:

ok correct answer

Test #2:

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

input:

message
20 20
85 C4 91 58 77 23 A9 E5 44 8E 28 DC A2 51 13 AE 4E 3C 21 62
37 5A 41 45 8F CA C3 89 01 68 11 72 D8 75 72 ED EE 64 FA B0
05 45 6E F2 FD CE 9A AC 31 CA 88 83 34 D6 23 1F 8C 6D 9E 8C
42 40 7E 18 4C D1 D3 F2 02 20 51 20 14 0F 3D 27 0E 03 73 D7
C0 1F C3 1D D3 55 D9 AF 6E 76 77 28 24 1A 97 E...

output:

58
00 14 00 14 85 C4 91 37 5A 41 44 8E 28 01 68 11 4E 3C 21 EE 64 FA 2F F6 21 9D 33 62 FB 26 E6 4C C0 11 08 50 9C 7B C2 3E AA 69 E2 E7 7E 59 09 07 80 57 EE 2D 11 B6 56 95 8F 05 

input:

parts
58
00 14 00 14 85 C4 91 37 5A 41 44 8E 28 01 68 11 4E 3C 21 EE 64 FA 2F F6 21 9D 33 62 FB 26 E6 4C C0 11 08 50 9C 7B C2 3E AA 69 E2 E7 7E 59 09 07 80 57 EE 2D 11 B6 56 95 8F 05
1
10 10
D0 0A D3 6D B9 31 31 76 54 15
CE 14 02 1A A2 8C 77 EB 8E 02
06 44 E4 F4 22 DB 66 F8 7E 38
C6 6A B7 5F E1 A0 0...

output:

6 6

result:

ok correct answer

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 3544kb

input:

message
20 20
12 4F 58 0D 8B AB 72 D1 55 0F FC 74 28 E3 B0 02 9E FA 18 C0
82 72 32 EB 29 EF 9D 70 E6 2D AC 15 37 31 40 A4 36 B6 58 2C
4E C2 4D AC C5 0F D1 A8 B2 2D 43 ED 00 63 7C 3B 3E C5 94 49
92 7D 2C 69 2B 6A 15 95 7C FD 67 E4 AC EE 01 F8 78 5F 46 57
54 7D 03 92 36 85 D0 C0 B1 14 22 70 9D 06 4E C...

output:

58
00 14 00 14 12 4F 58 82 72 32 55 0F FC E6 2D AC 9E FA 18 36 B6 58 88 0B D3 18 AE 6C 19 9C 17 19 00 61 EB 30 81 3E 08 11 45 22 10 01 26 C8 45 88 E8 85 17 88 5B 2D 0D 9D C0 ED 

input:

parts
58
00 14 00 14 12 4F 58 82 72 32 55 0F FC E6 2D AC 9E FA 18 36 B6 58 88 0B D3 18 AE 6C 19 9C 17 19 00 61 EB 30 81 3E 08 11 45 22 10 01 26 C8 45 88 E8 85 17 88 5B 2D 0D 9D C0 ED
9
10 10
12 4F 58 0D 8B AB 72 D1 55 0F
82 72 32 EB 29 EF 9D 70 E6 2D
4E C2 4D AC C5 0F D1 A8 B2 2D
92 7D 2C 69 2B 6A 1...

output:

1 1
11 11
1 11
11 1
1 1
11 1
1 1
1 1
1 1
1 11
1 11
1 11
1 1
1 1
1 1

result:

wrong answer wrong answer on query 8: read (1, 1) but expected (1, 11)