QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#524614#6568. Space Alignmentamirreza#WA 0ms3800kbC++202.2kb2024-08-19 21:02:042024-08-19 21:02:05

Judging History

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

  • [2024-08-19 21:02:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2024-08-19 21:02:04]
  • 提交

answer


// ki bood ke goft Ghatinga?

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppiii;

// vectors and Sets:
#define vc vector
#define pb push_back
#define all(c) (c).begin(), (c).end()

// pairs
#define mp make_pair
#define fr first
#define sc second

// execution time check and Debug
#define StartEX clock_t startExeTime = clock();
#define EndEX clock_t endExeTime = clock();
#define ExTime cerr << "\nTotal Execution Time is: " << double(-double(startExeTime)+double(endExeTime)) / CLOCKS_PER_SEC;
#define debug(x) cerr << #x << " : " << x << '\n'
#define endl "\n"

// time optimization
#define Heh ios::sync_with_stdio(false);cin.tie(0);
#define Bah ios::sync_with_stdio(false);
#pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")

// useful functions
ll pw(ll a,ll b){
  ll ret = 1;
  ll mul = a;
  while(b > 0){
	if(b&1)
	  ret = (ret * mul);
	mul = (mul * mul);
	b >>= 1;
  }
  return ret;
}
ll pw(ll a,ll b,ll mod){
  ll ret = 1;
  ll mul = a;
  while(b > 0){
	if(b&1)
	  ret = (ret * mul) % mod;
	mul = (mul * mul) % mod;
	b >>= 1;
  }
  return ret;
}

ll to_int(string s){
  ll ret = 0;
  for(int i = 0 ; i < (int)s.size() ; i++) ret = 10 * ret + s[i] - '0';
  return ret;
}

bool deq(ld a , ld b){return (abs(a-b) < 0.000001);} // 10 ^ -6

const int MAXP = 1e6 + 16;

int main()
{
  int n;
  cin >> n;
  string s[n];
  for(int i = 0 ; i < n ; i++) cin >> s[i];
  for(int t = 1 ; t <= 1001 ; t++){
    int k = 0;
    int ii = -1;
    
    for(int i = 0 ; i < n ; i++){
      if(s[i].back() == '}') k--;
      
      int ci = 0;
      for(char ch : s[i]){
	if(ch == 't') ci += t;
	if(ch == 's') ci += 1;
      }
      
      if(k == 0 and ci > 0){
	ii = -1;
	break;
      }
      else if(k == 0 and ci == 0){
      }
      else if(ci == 0){
	ii = -1;
	break;
      }
      else if(ci % k > 0 or (ii != -1 and ii != ci / k)){
	ii = -1;
	break;
      }
      if(k > 0) ii = ci / k;
      
      if(s[i].back() == '{') k++;
    }

    if(ii != -1){
      cout << t << endl;
      break;
    }
  }
}

// ki seda kard Patinga?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

2

result:

ok single line: '2'

Test #2:

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

input:

2
{
}

output:


result:

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