QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304873#4826. Find the Partsucup-team1390 1ms3504kbC++232.2kb2024-01-14 04:52:212024-01-14 04:52:22

Judging History

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

  • [2024-01-14 04:52:22]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3504kb
  • [2024-01-14 04:52:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

char cif[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
string tohex(int x){
    string res;
    res.push_back(cif[x/16]);
    res.push_back(cif[x%16]);
    return res;
}

void message(){
    int r,c;
    cin>>r>>c;
    
    vector<string> ans;
    ans.push_back(tohex(r/10));
    ans.push_back(tohex(r%10));
    ans.push_back(tohex(c/10));
    ans.push_back(tohex(c%10));
    
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            string s;
            cin>>s;
            if(j%10==0)ans.push_back(s);
        }
    }
    
    cout<<ans.size()<<"\n";
    for(auto i : ans)cout<<i<<" ";
    cout<<"\n";
}

void parts(){
    int m;
    cin>>m;
    
    int r=0,c=0;
    string s;
    cin>>s;
    r+=stoi(s,0,16)*10;
    cin>>s;
    r+=stoi(s,0,16);
    cin>>s;
    c+=stoi(s,0,16)*10;
    cin>>s;
    c+=stoi(s,0,16);
    
    vector mat(r,vector<string>(c/10+1));
    for(int i=0;i<r;i++){
        for(int j=0;j<=c/10;j++){
            cin>>mat[i][j];
        }
    }
    
    int q;
    cin>>q;
    
    for(int _=0;_<q;_++){
        int h,w;
        cin>>h>>w;
        
        vector tmp(h,vector<string>(w));
        for(int j=0;j<h;j++){
            for(int k=0;k<w;k++){
                cin>>tmp[j][k];
            }
        }
        
        bool gg=false;
        for(int col=0;col<w;col++){
            for(int col2=0;col2<c/10+1;col2++){
                for(int i=0;i+h<=r;i++){
                    bool ok=true;
                    for(int j=0;j<h;j++){
                        if(mat[i+j][col2]!=tmp[j][col])ok=false;
                    }
                    
                    if(ok){
                        cout<<i+1<<" "<<col2*10-col+1<<"\n";
                        gg=true;
                        break;
                    }
                }
                if(gg)break;
            }
            if(gg)break;
        }
        assert(gg);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin>>s;
    
    if(s=="message")message();
    else parts();
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3468kb

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:

64
02 00 02 04 33 0B 1C 86 EA 85 14 6F AA 85 D9 72 E5 EF 4B 25 AA FF CD EA F9 F8 40 9E F7 D2 86 7B 60 3D EC 66 DC BF 53 7E 4A D4 F1 5A DB 10 B6 72 16 91 00 E1 92 EF B7 10 E8 62 5F 35 4E C1 07 C3 

input:

parts
64
02 00 02 04 33 0B 1C 86 EA 85 14 6F AA 85 D9 72 E5 EF 4B 25 AA FF CD EA F9 F8 40 9E F7 D2 86 7B 60 3D EC 66 DC BF 53 7E 4A D4 F1 5A DB 10 B6 72 16 91 00 E1 92 EF B7 10 E8 62 5F 35 4E C1 07 C3
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
2...

output:

1 2
6 5

result:

ok correct answer

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3504kb

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
02 00 02 00 85 28 37 11 05 88 42 51 C0 77 8D 31 3F 8C 0B DB B9 A0 2F E6 9D 11 DD 1E 96 1B A3 72 EC 6A B1 6E 16 82 47 F5 AA 80 E7 2D 

input:

parts
44
02 00 02 00 85 28 37 11 05 88 42 51 C0 77 8D 31 3F 8C 0B DB B9 A0 2F E6 9D 11 DD 1E 96 1B A3 72 EC 6A B1 6E 16 82 47 F5 AA 80 E7 2D
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:


result:

wrong output format Unexpected end of file - int32 expected