답안 #1040925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040925 2024-08-01T12:24:07 Z 7again Lasers (NOI19_lasers) C++17
63 / 100
138 ms 262144 KB
#include <bits/stdc++.h>
#define int long long
#define double long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define FAST ios::sync_with_stdio(0);cout.tie(0);cin.tie(0)
//#define endl "\n"
#define f first
#define s second
#define pb push_back
#define in insert

//#define ind(v,t) distance(v.begin(),t)
using namespace std ;

int MOD = 1e18 ;
const int N = 200000 ;

//int fib(int n){double phi=(1+sqrt(5))/2;return round((pow(phi,n)-pow(1-phi,n))/sqrt(5));}
//void setIO(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
int fstpow(int a, int b){if(b==0)return 1;int ans=fstpow(a,b/2)%MOD;ans=ans%MOD*ans%MOD;if(b&1)return a*ans%MOD;return ans%MOD;}
int inv(int x){return fstpow(x,MOD-2);}
int DMOD(int x,int y){x%=MOD;y%=MOD;return fstpow(x,inv(y));}
int MMOD(int x,int y){x%=MOD;y%=MOD;return (x*y)%MOD;}
//int AMOD(int x,int y){x%=MOD;y%=MOD;return (x+y)%MOD;}
int SMOD(int x,int y){x%=MOD;y%=MOD;return (x-y+MOD)%MOD;}
//int Factorial[N];void FAC(){Factorial[0]=1;for(int i=1;i<=2e6;i++)Factorial[i]=(Factorial[i-1]%MOD*i%MOD)%MOD;}
//int PREFIX[3e6];void PFX(){PREFIX[0]=0;for(int i=1;i<=2e6;i++)PREFIX[i]=PREFIX[i]+PREFIX[i-1]+i;}
//fill_n(&a[0][0],(n+1)*(m+1),valu);
//int C(int x,int y){int A=1,B=1;for(int i=y+1;i<=x;i++)A*=i;for(int i=2;i<=x-y;i++)B*=i;return A/B;}

void slv()
{
    int n , m ;
    cin >> n >> m ;

    vector <int> pfx(n + 1 , 0) ;
    for(int t = 0 ; t < m ; t++)
    {
        int s ;
        cin >> s ;

        vector <int> v(s) ;
        double sum = 0 , sum2 = 0 ;
        for(int i = 0 ; i < s ; i++)
        {
            cin >> v[i] ;
            sum += v[i] ;
        }

        for(int i = 0 ; i < s ; i++)
        {
            int l = n - (sum - sum2) + 1 , r = sum2 + v[i] + 1 ;
            if(r > l)
                pfx[l]++ , pfx[r]-- ;
            sum2 += v[i] ;
        }
    }

    int ans = 0 ;
    for(int i = 1 ; i <= n ; i++)
        pfx[i] += pfx[i - 1] ;
    for(int i = 0 ; i <= n ; i++)
        ans += (pfx[i] > 0) ;

    cout << ans ;
}
main()
{

    //FAST ;

    int t = 1 ;
    //cin >> t ;

    while(t--)
        slv() ;
}

//TLE Problem ?
/*
    -> const MOD
    -> const int
    -> FAST
    -> "/n" | endl
    -> array size
*/

//MLE Problem ?
/*
    -> array size()
    -> N ?
    -> long long
    -> define
    -> long long dp[1000][100000] ? ;
*/

//RTE problem ?
/*
    -> array size ?
    -> x / 0 ?
*/

Compilation message

lasers.cpp:68:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   68 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 75 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 75 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 9080 KB Output is correct
2 Correct 11 ms 8284 KB Output is correct
3 Correct 12 ms 8468 KB Output is correct
4 Correct 30 ms 9780 KB Output is correct
5 Correct 17 ms 9564 KB Output is correct
6 Correct 32 ms 10580 KB Output is correct
7 Correct 3 ms 6748 KB Output is correct
8 Correct 38 ms 9788 KB Output is correct
9 Correct 18 ms 8540 KB Output is correct
10 Correct 32 ms 9432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 9080 KB Output is correct
2 Correct 11 ms 8284 KB Output is correct
3 Correct 12 ms 8468 KB Output is correct
4 Correct 30 ms 9780 KB Output is correct
5 Correct 17 ms 9564 KB Output is correct
6 Correct 32 ms 10580 KB Output is correct
7 Correct 3 ms 6748 KB Output is correct
8 Correct 38 ms 9788 KB Output is correct
9 Correct 18 ms 8540 KB Output is correct
10 Correct 32 ms 9432 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 131 ms 11336 KB Output is correct
22 Correct 19 ms 8176 KB Output is correct
23 Correct 12 ms 8108 KB Output is correct
24 Correct 44 ms 9084 KB Output is correct
25 Correct 130 ms 11352 KB Output is correct
26 Correct 37 ms 8512 KB Output is correct
27 Correct 17 ms 8024 KB Output is correct
28 Correct 138 ms 11264 KB Output is correct
29 Correct 132 ms 11560 KB Output is correct
30 Correct 40 ms 8948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 75 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -