제출 #1125804

#제출 시각아이디문제언어결과실행 시간메모리
1125804thunoproTopical (NOI23_topical)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define maxn 1000009 #define ll long long #define fi first #define se second #define pb push_back #define re exit(0); #define left id<<1 #define right id<<1|1 #define _lower(x) lower_bound(v.begin(),v.end(),x)-v.begin() + 1 const int mod = 1e9+7; const int INF = 1e9; typedef vector<int> vi ; typedef pair<int,int> pii ; typedef vector<pii> vii ; void add ( int &a , int b ) { a += b ; if ( a >= mod ) a -= mod ; if ( a < 0 ) a += mod ; } template < typename T > void chkmin ( T &a , T b ) { if ( a > b ) a = b ; } template < typename T > void chkmax ( T &a , T b ) { if ( a < b ) a = b ; } void runfile() { freopen ("bai1.inp","r",stdin) ; } int _pow ( int a , int n ) { if ( n == 0 ) return 1 ; int res = _pow (a,n/2) ; if ( n % 2 ) return 1ll*res*res%mod*a%mod ; else return 1ll*res*res%mod ; } int n , k ; vector<int> r [maxn] , u[maxn] ; int p [maxn] ; int cnt [maxn] ; vector<pii> requires [maxn] ; bool cmp ( pii u , pii v ) { return u.fi < v.fi ; } int cur [maxn] ; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); // runfile() ; cin >> n >> k ; for ( int i = 1 ; i <= n ; i ++ ) r [i].resize(k+1) , u [i].resize(k+1) ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = 1 ; j <= k ; j ++ ) cin >> r [i][j] ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = 1 ; j <= k ; j ++ ) cin >> u [i][j] ; for ( int i = 1 ; i <= k ; i ++ ) p [i] = 0 ; for ( int j = 1 ; j <= k ; j ++ ) requires[j].resize(n+1) ; for ( int j = 1 ; j <= k ; j ++ ) for ( int i = 1 ; i <= n ; i ++ ) requires [j][i] = {r[i][j],i} ; for ( int j = 1 ; j <= k ; j ++ ) sort (requires[j].begin()+1,requires[j].begin()+n+1,cmp) ; for ( int j = 1 ; j <= k ; j ++ ) cur [j] = 1 ; int res = 0 ; while ( true ) { bool changed = false ; for ( int j = 1 ; j <= k ; j ++ ) { while ( p [j] >= requires[j][cur[j]].fi ) { if ( ++ cnt [requires[j][cur[j]].se] == k ) { for ( int run = 1 ; run <= k ; run ++ ) { p [run] += u [requires[j][cur[j]].se][run] ; } res ++ ; } cur [j] ++ ; changed = true ; } } if ( changed == false ) break ; } cout << res ; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:44:13: error: expected unqualified-id before 'requires'
   44 | vector<pii> requires [maxn] ;
      |             ^~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:64:51: error: expected '{' before '[' token
   64 |         for ( int j = 1 ; j <= k ; j ++ ) requires[j].resize(n+1) ;
      |                                                   ^
Main.cpp:65:86: error: expected '{' before '[' token
   65 |         for ( int j = 1 ; j <= k ; j ++ ) for ( int i = 1 ; i <= n ; i ++ ) requires [j][i] = {r[i][j],i} ;
      |                                                                                      ^
Main.cpp:66:57: error: expected '{' before '[' token
   66 |         for ( int j = 1 ; j <= k ; j ++ ) sort (requires[j].begin()+1,requires[j].begin()+n+1,cmp) ;
      |                                                         ^
Main.cpp:66:79: error: expected '{' before '[' token
   66 |         for ( int j = 1 ; j <= k ; j ++ ) sort (requires[j].begin()+1,requires[j].begin()+n+1,cmp) ;
      |                                                                               ^
Main.cpp:75:50: error: expected '{' before '[' token
   75 |                         while ( p [j] >= requires[j][cur[j]].fi )
      |                                                  ^
Main.cpp:77:54: error: expected '{' before '[' token
   77 |                                 if ( ++ cnt [requires[j][cur[j]].se] == k )
      |                                                      ^
Main.cpp:81:71: error: expected '{' before '[' token
   81 |                                                 p [run] += u [requires[j][cur[j]].se][run] ;
      |                                                                       ^
Main.cpp: In function 'void runfile()':
Main.cpp:29:26: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 | void runfile() { freopen ("bai1.inp","r",stdin) ; }
      |                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~