Submission #46305986
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(i, j, n) for (ll i = (ll)(j); i <= (ll)(n); ++i)
#define all(v) v.begin(), v.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9 + 7;
const int mod = 998244353;
const ll INF = 2e15;
template <class T>
void print(const T& t) {
cout << t << endl;
}
template <class T>
inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
/*
ll ti=clock();
cout<<("Execution Time: %.4lf sec", 1.0 * (clock() - ti) /
CLOCKS_PER_SEC)<<endl;
*/
int main(){
ll n,m;
cin>>n>>m;
vl a(m);
rep(i,m) {
cin>>a[i];
}
vector<string> s(n);
ll max_score=0;
vl now_score(n);
rep(i,n){
cin>>s[i];
now_score[i]=i+1;
rep(j,sz(s[i])){
if(s[i][j]=='o'){
now_score[i]+=a[j];
}
}
chmax(max_score, now_score[i]);
}
rep(i,n){
if(now_score[i]==max_score){
print(0);
continue;
}
ll score = now_score[i];
vl unresolved_scores(0);
rep(j,sz(s[i])){
if(s[i][j]=='x'){
unresolved_scores.pb(a[j]);
}
}
sort(all(unresolved_scores));
reverse(all(unresolved_scores));
ll count=0;
while(score<max_score){
score+=unresolved_scores[count];
count++;
}
print(count);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - World Tour Finals |
| User | replica |
| Language | C++ 20 (gcc 12.2) |
| Score | 250 |
| Code Size | 1817 Byte |
| Status | AC |
| Exec Time | 2 ms |
| Memory | 3628 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 250 / 250 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3488 KiB |
| 00_sample_02.txt | AC | 1 ms | 3472 KiB |
| 00_sample_03.txt | AC | 1 ms | 3408 KiB |
| 01_test_01.txt | AC | 2 ms | 3624 KiB |
| 01_test_02.txt | AC | 2 ms | 3628 KiB |
| 01_test_03.txt | AC | 2 ms | 3556 KiB |
| 01_test_04.txt | AC | 2 ms | 3488 KiB |
| 01_test_05.txt | AC | 2 ms | 3492 KiB |
| 01_test_06.txt | AC | 2 ms | 3548 KiB |
| 01_test_07.txt | AC | 2 ms | 3512 KiB |
| 01_test_08.txt | AC | 2 ms | 3564 KiB |
| 01_test_09.txt | AC | 1 ms | 3556 KiB |
| 01_test_10.txt | AC | 1 ms | 3492 KiB |
| 01_test_11.txt | AC | 1 ms | 3500 KiB |