QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#500962#8791. Tasks and Bugsydzr00000WA 0ms8456kbC++201.4kb2024-08-02 08:12:012024-08-02 08:12:02

Judging History

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

  • [2024-08-02 08:12:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:8456kb
  • [2024-08-02 08:12:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline int string_to_number(string s)
{
    int num=0,len=s.length();
    for(int i=0;i<len;i++)
        num=(num<<1)+(num<<3)+(s[i]^48);
    return num;
}
set<int>st[100001];
set<int>tk;
int main(){
	string str;
    while(getline(cin,str))
    {
        str+=" ";
        int len=str.length();
        string bug="";
        int now=0;
        bool flag=false;
        for(int i=3;i<len;i++)
        {
            if(isdigit(str[i]))
            {
                bug+=str[i];
                flag=true;
            }
            else if(flag)
            {
                now=i;
                break;
            }
        }
        int bugid=string_to_number(bug);
        string task="";
        for(int i=now;i<len;i++)
        {
            if(isdigit(str[i]))
                task+=str[i];
            else
            {
                if(task!="")
                {
                    int tid=string_to_number(task);
                    st[tid].insert(bugid);
                    tk.insert(tid);
                }
                task="";
            }
        }
    }
    for(auto tkid: tk)
    {
        printf("CS-%d: ",tkid);
        int num=*(--st[tkid].end());
        for(auto bugid: st[tkid])
            printf("CS-%d%c%c",bugid,", "[bugid==num]," \n"[bugid==num]);
    }
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

CS-20: CS-1
CS-100: CS-239
CS-300: CS-239, CS-11111

output:

CS-1: CS-20 
CS-239: CS-100, CS-300 
CS-11111: CS-300 

result:

wrong answer 1st lines differ - expected: 'CS-1: CS-20', found: 'CS-1: CS-20 '