QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743640#2827. AutobiographyOOBMABTRAMS#WA 0ms30072kbC++17796b2024-11-13 19:41:562024-11-13 19:41:57

Judging History

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

  • [2024-11-13 19:41:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:30072kb
  • [2024-11-13 19:41:56]
  • 提交

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();
}

详细

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: ''