답안 #1007875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007875 2024-06-25T16:36:06 Z kebine Lasers (NOI19_lasers) C++17
0 / 100
15 ms 18532 KB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<ll,ll>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define freeopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define mod 998244353
#define pb push_back
#define mk make_pair
#define ll long long
#define foor(x,vec) for(auto x:vec ){cout<<x<<" ";}
#define fi first
#define se second
#define MAXN 500069
#define lld long double
#define cha ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ffl fflush(stdout)
#define sst string
#define pii pair<ll,ll>
ll mvx[]={0,0,-1,1};
ll mvy[]={1,-1,0,0};
ll n,q;

ll k[MAXN];
vector<ll> b[MAXN];
ll vis[MAXN];
void solve(){
    cin>>n>>q;
    REP(i,0,q-1){
        cin>>k[i];
        REP(j,0,k[i]-1){
            ll x;
            cin>>x;
            b[i].pb(x);
        }
    }
    ll ans=0;
    REP(i,0,q-1){
        ll mx=0;
        REP(j,0,k[i]-1){
            mx=max(mx,b[i][j]);
        }
        ans+=(n-2*(n-mx));
    }
    cout<<ans<<endl;
}
int main(){
    cha
    ll tc=1;
//    cin>>tc;
    while(tc--){
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 13656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 13656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 18532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 13656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 18532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 13656 KB Output isn't correct
2 Halted 0 ms 0 KB -