QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321876 | #4826. Find the Parts | tuanlinh123 | 0 | 0ms | 3816kb | C++20 | 2.5kb | 2024-02-05 20:02:32 | 2024-02-05 20:02:33 |
answer
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
auto num_to_hex=[&](ll num)
{
ll f=num/16, s=num%16;
string res=" ";
res[0]=f<10?'0'+f:'A'-10+f;
res[1]=s<10?'0'+s:'A'-10+s;
return res;
};
auto hex_to_num=[&](string s)
{
ll f=s[0]<='9'?s[0]-'0':s[0]-'A'+10;
ll r=s[1]<='9'?s[1]-'0':s[1]-'A'+10;
return f*16+r;
};
string s; cin >> s;
if (s=="message")
{
ll n, m; cin >> n >> m;
vector <string> ans;
ans.pb(num_to_hex(n%256)), ans.pb(num_to_hex(n/256));
ans.pb(num_to_hex(m%256)), ans.pb(num_to_hex(m/256));
for (ll i=1; i<=n; i++)
for (ll j=1; j<=m; j++)
{
string t; cin >> t;
if (i%10==1) ans.pb(t);
}
cout << ans.size() << "\n";
for (string i:ans) cout << i << " ";
}
else
{
ll k, crr=4; cin >> k;
vector <string> a(k);
for (ll i=0; i<k; i++) cin >> a[i];
ll n=(hex_to_num(a[0])+hex_to_num(a[1])*256-1)/10+1;
ll m=hex_to_num(a[2])+hex_to_num(a[3])*256;
vector <vector <ll>> s(n, vector <ll> (m));
for (ll i=0; i<n; i++)
for (ll j=0; j<m; j++)
s[i][j]=hex_to_num(a[crr++]);
map <__int128_t, pll> Map;
for (ll i=0; i<n; i++)
for (ll j=0; j+10<m; j++)
{
__int128_t cr=0;
for (ll k=j; k<j+10; k++)
cr<<=8, cr+=s[i][k];
Map[cr]={i*10+1, j+1};
}
ll q; cin >> q;
for (ll z=0; z<q; z++)
{
ll n, m; cin >> n >> m;
vector <vector <ll>> a(10, vector <ll> (10));
for (ll i=0; i<n; i++)
for (ll j=0; j<m; j++)
{
string t; cin >> t;
if (i<10 && j<10) a[i][j]=hex_to_num(t);
}
for (ll i=0; i<10; i++)
{
__int128_t cr=0;
for (ll j=0; j<10; j++)
cr<<=8, cr+=a[i][j];
if (Map[cr].fi)
cout << Map[cr].fi-i << " " << Map[cr].se << "\n";
}
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3816kb
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:
52 14 00 18 00 33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81 EC C9 BE 91 3B DF 1C DC 61 5C 66 1C B3 26 1C 2E 11 0D 19 BD DC 08 1A 90
input:
parts 52 14 00 18 00 33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81 EC C9 BE 91 3B DF 1C DC 61 5C 66 1C B3 26 1C 2E 11 0D 19 BD DC 08 1A 90 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 7B 3F EE D9 8A 73 E...
output:
1 2 6 5
result:
ok correct answer
Test #2:
score: 100
Accepted
time: 0ms
memory: 3816kb
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:
44 14 00 14 00 85 C4 91 58 77 23 A9 E5 44 8E 28 DC A2 51 13 AE 4E 3C 21 62 9D 33 62 48 62 6C AB B1 4C C0 11 B6 DE 71 C2 E9 7B C2 3E 00
input:
parts 44 14 00 14 00 85 C4 91 58 77 23 A9 E5 44 8E 28 DC A2 51 13 AE 4E 3C 21 62 9D 33 62 48 62 6C AB B1 4C C0 11 B6 DE 71 C2 E9 7B C2 3E 00 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 0D F0 F5 8A AC DB B0 FB 26 E6 12 36 37 F1 6...
output:
6 6
result:
ok correct answer
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3780kb
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:
44 14 00 14 00 12 4F 58 0D 8B AB 72 D1 55 0F FC 74 28 E3 B0 02 9E FA 18 C0 18 AE 6C 74 6C 58 52 A4 19 00 61 07 33 D1 BE BA 3E 08 11 C9
input:
parts 44 14 00 14 00 12 4F 58 0D 8B AB 72 D1 55 0F FC 74 28 E3 B0 02 9E FA 18 C0 18 AE 6C 74 6C 58 52 A4 19 00 61 07 33 D1 BE BA 3E 08 11 C9 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 15 95 7C FD 54 7D 03 92 36 85 D0 C0 B1 14 A...
output:
1 1 11 1 1 1 11 1 1 1 1 1
result:
wrong answer wrong answer on query 2: read (11, 1) but expected (11, 11)