Submission #293045

# Submission time Handle Problem Language Result Execution time Memory
293045 2020-09-07T15:47:23 Z 최은수(#5797) Robogolf (ROI19_golf) C++17
0 / 100
83 ms 5876 KB
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
const int mod=998244353;
inline int add(int x,int y)
{
    return x+y<mod?x+y:x+y-mod;
}
inline int sub(int x,int y)
{
    return x<y?x+mod-y:x-y;
}
inline int mul(int x,int y)
{
    return(int)((ll)x*y%mod);
}
map<int,int>mp;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,k;
    cin>>n>>m>>k;
    int ans=0;
    vector<pi>v(k);
    for(pi&t:v)
    {
        int d;
        cin>>t.fi>>t.se>>d;
    }
    sort(all(v),[](const pi&x,const pi&y){return pi(x.fi+x.se,x.fi-x.se)<pi(y.fi+y.se,y.fi-y.se);});
    for(int i=1;i<k;i++)
        if(v[i-1].fi==v[i].fi-1&&v[i-1].se==v[i].se+1)
            mp[v[i].fi-v[i].se-1]=max(mp[v[i].fi-v[i].se-1],min(v[i].fi-1,v[i].se));
    for(pi&t:v)
        mp[t.fi-t.se]=max(mp[t.fi-t.se],min(t.fi,t.se));
    for(auto t:mp)
        ans=add(ans,t.se%mod);
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 5876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 4600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 4600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -