QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#800694#8791. Tasks and Bugsucup-team6015#WA 4ms27236kbC++171.6kb2024-12-06 14:36:402024-12-06 14:36:40

Judging History

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

  • [2024-12-06 14:36:40]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:27236kb
  • [2024-12-06 14:36:40]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, l, r) for(int i = l; i < r; i++)
#define hrp(i, l, r) for(int i = l; i <= r; i++)
#define rev(i, r, l) for(int i = r; i >= l; i--)
#define int ll
using namespace std;
typedef long long ll;
template<typename tn = int> tn next(void) { tn k; cin>>k; return k; }
#ifndef LOCAL
#define D(...) 0
#define I(...) 0
#endif
const int U = 1.01e6;
vector<int> tail[U];
int toNum(string str)
{
    int ret = 0;
    rep(i, 3, str.size()) ret += str[i]-'0', ret *= 10;
    return ret/10;
}
signed main(void)
{
    #ifdef LOCAL
	freopen("C:\\Users\\Loxil\\Desktop\\IN.txt", "r", stdin);
//	freopen("C:\\Users\\Loxil\\Desktop\\OUT.txt", "w", stdout);
    #endif
    
    int cnt = 0;
    string str;
    while(getline(cin, str))
    {
        string cur;
        int head = 0, pos = -1;
        while(++pos < str.size())
        {
            if (str[pos] == ' ') continue;
            if (str[pos] == ':') { head = toNum(cur); D(head); cur.clear(); continue; }
            if (str[pos] == ',') { tail[head].push_back(toNum(cur)); cur.clear(); continue; }
            cur += str[pos];
        }
        tail[head].push_back(toNum(cur));
    }

    rep(i, 1, 1000000) if (tail[i].size())
    {
        cout<<"CS-"<<i<<": ";
        sort(tail[i].begin(), tail[i].end());

        rep(j, 0, tail[i].size())
        {
            cout<<"CS-"<<tail[i][j];
            if (j != tail[i].size()-1) cout<<", ";
        }
        cout<<endl;
    }
    
    return 0;
}
/*
CS-20: CS-1
CS-100: CS-239
CS-300: CS-239, CS-11111
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 27236kb

input:

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

output:

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

result:

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