QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#10741#559. 原力Pdw2007Compile Error//C++1.4kb2021-06-18 15:07:382021-12-19 12:46:24

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2021-12-19 12:46:24]
  • Judged
  • [2021-06-18 15:07:38]
  • Submitted

answer

#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,l,r) for (int i=l; i<=r; i++)
typedef long long ll;
using namespace std;

const int N=50100,mod=1000000007;
struct data{
    int x,y,z; data() {}
    data(int a,int b,int c) {x=a,y=b,z=c;}
    bool operator<(const data &a)const {return x == a.x ? y == a.y ? z < a.z : y < a.y : x < a.x;}
};
map<data,ll> mp;
int n,m,si,x,y,z,t,head[N],to[N << 2],val[N << 2],opt[N << 2],next[N << 2],cnt,d[N],id[350],tot;
char str[5];

void add(int x,int y,int v,int c){ to[++cnt]=y,val[cnt]=v,opt[cnt]=c,next[cnt]=head[x],head[x]=cnt; }

int main(){
    ll ans=0; scanf("%d%d",&n,&m),si=(int)sqrt(m);
    rep(i,1,m){
        scanf("%d%d%d%s",&x,&y,&z,str);
        t=(str[0] == 'R' ? 1 : str[0] == 'G' ? 2 : 3);
        add(x,y,z,t),add(y,x,z,t),d[x] ++,d[y] ++ ;
        (mp[data(x,y,t)] += z) %= mod,(mp[data(y,x,t)] += z) %= mod;
    }
    rep(i,1,n) if(d[i] >= si) id[++tot]=i;
    rep(i,1,tot) rep(j,1,tot) rep(k,1,tot)
        ans=(ans+mp[data(id[i],id[j],1)]*mp[data(id[i],id[k],2)]%mod*mp[data(id[j],id[k],3)])%mod;
    rep(i,1,n) if(d[i] < si)
        for(int j=head[i] ; j ; j=next[j])
            if(d[to[j]] >= si || to[j] > i)
                for(int k=next[j]; k; k=next[k])
                    if(opt[k]!=opt[j] && (d[to[k]]>=si || to[k]>i))
                            ans=(ans+mp[data(to[j],to[k],6-opt[j]-opt[k])]*val[j]%mod*val[k])%mod;
    printf("%lld\n",ans);
    return 0;
}

详细

answer.code: In function ‘void add(int, int, int, int)’:
answer.code:18:70: error: reference to ‘next’ is ambiguous
   18 | void add(int x,int y,int v,int c){ to[++cnt]=y,val[cnt]=v,opt[cnt]=c,next[cnt]=head[x],head[x]=cnt; }
      |                                                                      ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:66,
                 from /usr/include/c++/10/bits/stl_tree.h:63,
                 from /usr/include/c++/10/map:60,
                 from answer.code:1:
/usr/include/c++/10/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: ‘template<class _InputIterator> _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)’
  213 |     next(_InputIterator __x, typename
      |     ^~~~
answer.code:15:63: note:                 ‘int next [200400]’
   15 | int n,m,si,x,y,z,t,head[N],to[N << 2],val[N << 2],opt[N << 2],next[N << 2],cnt,d[N],id[350],tot;
      |                                                               ^~~~
answer.code: In function ‘int main()’:
answer.code:32:35: error: reference to ‘next’ is ambiguous
   32 |         for(int j=head[i] ; j ; j=next[j])
      |                                   ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:66,
                 from /usr/include/c++/10/bits/stl_tree.h:63,
                 from /usr/include/c++/10/map:60,
                 from answer.code:1:
/usr/include/c++/10/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: ‘template<class _InputIterator> _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)’
  213 |     next(_InputIterator __x, typename
      |     ^~~~
answer.code:15:63: note:                 ‘int next [200400]’
   15 | int n,m,si,x,y,z,t,head[N],to[N << 2],val[N << 2],opt[N << 2],next[N << 2],cnt,d[N],id[350],tot;
      |                                                               ^~~~
answer.code:34:27: error: reference to ‘next’ is ambiguous
   34 |                 for(int k=next[j]; k; k=next[k])
      |                           ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:66,
                 from /usr/include/c++/10/bits/stl_tree.h:63,
                 from /usr/include/c++/10/map:60,
                 from answer.code:1:
/usr/include/c++/10/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: ‘template<class _InputIterator> _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)’
  213 |     next(_InputIterator __x, typename
      |     ^~~~
answer.code:15:63: note:                 ‘int next [200400]’
   15 | int n,m,si,x,y,z,t,head[N],to[N << 2],val[N << 2],opt[N << 2],next[N << 2],cnt,d[N],id[350],tot;
      |                                                               ^~~~
answer.code:34:41: error: reference to ‘next’ is ambiguous
   34 |                 for(int k=next[j]; k; k=next[k])
      |                                         ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:66,
                 from /usr/include/c++/10/bits/stl_tree.h:63,
                 from /usr/include/c++/10/map:60,
                 from answer.code:1:
/usr/include/c++/10/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: ‘template<class _InputIterator> _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)’
  213 |     next(_InputIterator __x, typename
      |     ^~~~
answer.code:15:63: note:                 ‘int next [200400]’
   15 | int n,m,si,x,y,z,t,head[N],to[N << 2],val[N << 2],opt[N << 2],next[N << 2],cnt,d[N],id[350],tot;
      |                                                               ^~~~
answer.code:21:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     ll ans=0; scanf("%d%d",&n,&m),si=(int)sqrt(m);
      |               ~~~~~^~~~~~~~~~~~~~
answer.code:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |         scanf("%d%d%d%s",&x,&y,&z,str);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~