QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#743640 | #2827. Autobiography | OOBMABTRAMS# | WA | 0ms | 30072kb | C++17 | 796b | 2024-11-13 19:41:56 | 2024-11-13 19:41:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9;
const int N=1000013;
int n,m;
vector<int>mp[N];
ll cb[N],co[N];
void solve(){
string s;
cin>>s;
s=' '+s;
for(int i=1;i<=m;i++)mp[i].clear(),cb[i]=co[i]=0;
vector<pair<int,int>>eg;
for(int x,y,i=1;i<=m;i++) {
cin>>x>>y;
mp[x].push_back(y),mp[y].push_back(x);
if(s[y]=='b')cb[x]++;else co[x]++;
if(s[x]=='b')cb[y]++;else co[y]++;
eg.emplace_back(x,y),eg.emplace_back(y,x);
}
ll ans=0;
for(auto [x,y]:eg)if(s[x]=='o'&&s[y]=='b') {
ans+=(cb[x]-1)*(co[y]-1);
}
cout<<ans<<'\n';
cout<<endl;
}
int main() {
int T=1;
ios::sync_with_stdio(false);
while(cin>>n>>m)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 30072kb
input:
5 4 bbobo 1 3 2 3 3 4 4 5 4 6 bobo 1 2 1 3 1 4 2 3 2 4 3 4 4 0 bobo
output:
2 4 0
result:
wrong answer 2nd lines differ - expected: '4', found: ''