QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415596#6568. Space Alignmentngpin04#WA 0ms3636kbC++141.6kb2024-05-21 03:57:272024-05-21 03:57:27

Judging History

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

  • [2024-05-21 03:57:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-05-21 03:57:27]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first 
#define se second
#define mp make_pair
#define bit(n) (1LL << (n))
#define getbit(x, i) (((x) >> (i)) & 1)
#define ii pair <int, int>
#define ALL(x) x.begin(), x.end()
#define long long long
using namespace std;
const int oo = 1e9;
const long ooo = 1e18;


vector<ii> vec[501];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    int depth = 0;
    for(int i = 0; i < n; i++)
    {
        int s = 0;
        int t = 0;
        string str; cin >> str;
        for(char c : str)
        {
            s += (c == 's');
            t += (c == 't');
        }

        if(str.back() == '}') depth--;

        vec[depth].push_back({s,t});
        
        if(str.back() == '{') depth++;
        
    }
    for(int i = 0; i <= 2000; i++)
    {
        bool bol = 1;
        for(auto it : vec[0])
        {
            int val = it.fi+it.se*i;
            // cout << "0 " << val << '\n';
            if(val) bol = 0;
        }
        if(!bol) continue;

        set<int> st;
        for(int j = 1; j <= 100; j++)
        {
            for(auto it : vec[j])
            {
                int val = it.fi+it.se*i;
                // cout << i << " " << j << " " << val << '\n';
                if(val%j != 0) bol = 0;
                st.insert(val/j);
            }
        }
        if(!bol) continue;
        
        if(st.size() <= 1)
        {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n"; 

    return 0;
}

详细

Test #1:

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

input:

10
{
ss{
sts{
tt}
t}
t{
ss}
}
{
}

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

2
{
}

output:

0

result:

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