QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#664742 | #7155. Padel Prize Pursuit | packmani# | Compile Error | / | / | C++14 | 1.8kb | 2024-10-21 22:07:14 | 2024-10-21 22:07:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
//#define int long long int
//#define pii pair<int,int>
struct node
{
int lasttm, winner, loser;
};
const int SZ = 200010;
vector<int> last[SZ];
vector<node> adj[SZ];
int tm[SZ];
int cnt[SZ];
int vis[SZ];
int n,m,winner,loser;
int win[SZ];
void dfs(int curtime, int latesttime, int curking, int curbesttime)
{
//cout << curtime-1 << ' ' << adj[curtime].winner << ' ' << latesttime-curtime << ' ';
vis[curtime]=1;
int winner = win[curtime];
tm[winner]+=latesttime-curtime;
//cout << tm[winner] << ' ';
if(tm[winner]>curbesttime)
{
curbesttime=tm[winner];
curking=winner;
}
else if(tm[winner]==curbesttime)
{
if(winner<curking) curking=winner;
}
cnt[curking]++;
for(auto to:adj[curtime])
{
if(to.lasttm!=curtime and vis[to.lasttm]==0)
dfs(to.lasttm, curtime, curking, curbesttime);
}
tm[winner]-=latesttime-curtime;
return;
}
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
cin >> n >> m;
for(int i=1;i<=m;i++)
{
cin >> winner >> loser;
if(last[loser].empty() and last[winner].empty()) adj[i].push_back({i, winner, loser});
else if(last[loser].empty() and !last[winner].empty())
{
for(int j=0;j<last[winner].size();j++)
adj[i].push_back({last[winner][j],winner,loser});
last[winner].clear();
}
else
{
for(int j=0;j<last[loser].size();j++)
adj[i].push_back({last[loser][j],winner,loser});
last[loser].clear();
}
//cout << i << ' ' << last[winner] << ' ' << last[loser] << '\n';
last[winner].push_back(i);
last[loser].clear();
win[i]=winner;
}
for(int i=m;i>=1;i--)
{
if(vis[i]) continue;
//cout << "call\n";
dfs(i,m+1,n+5,0);
}
for(int i=0;i<n;i++)
{
cout << cnt[i] << ' ' ;
}
}
详细
answer.code: In function ‘void dfs(int, int, int, int)’: answer.code:22:9: error: reference to ‘tm’ is ambiguous 22 | tm[winner]+=latesttime-curtime; | ^~ In file included from /usr/include/time.h:39, from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr.h:148, from /usr/include/c++/13/ext/atomicity.h:35, from /usr/include/c++/13/bits/ios_base.h:39, from /usr/include/c++/13/streambuf:43, from /usr/include/c++/13/bits/streambuf_iterator.h:35, from /usr/include/c++/13/iterator:66, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:54, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: ‘struct tm’ 7 | struct tm | ^~ answer.code:12:5: note: ‘int tm [200010]’ 12 | int tm[SZ]; | ^~ answer.code:24:12: error: reference to ‘tm’ is ambiguous 24 | if(tm[winner]>curbesttime) | ^~ /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: ‘struct tm’ 7 | struct tm | ^~ answer.code:12:5: note: ‘int tm [200010]’ 12 | int tm[SZ]; | ^~ answer.code:26:29: error: reference to ‘tm’ is ambiguous 26 | curbesttime=tm[winner]; | ^~ /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: ‘struct tm’ 7 | struct tm | ^~ answer.code:12:5: note: ‘int tm [200010]’ 12 | int tm[SZ]; | ^~ answer.code:29:17: error: reference to ‘tm’ is ambiguous 29 | else if(tm[winner]==curbesttime) | ^~ /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: ‘struct tm’ 7 | struct tm | ^~ answer.code:12:5: note: ‘int tm [200010]’ 12 | int tm[SZ]; | ^~ answer.code:39:9: error: reference to ‘tm’ is ambiguous 39 | tm[winner]-=latesttime-curtime; | ^~ /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: ‘struct tm’ 7 | struct tm | ^~ answer.code:12:5: note: ‘int tm [200010]’ 12 | int tm[SZ]; | ^~