Submission #310598

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3105982020-10-07 13:30:18Ruxandra985Tug of War (BOI15_tug)C++14
100 / 100
1085 ms9752 KiB
#include <bits/stdc++.h>
#define DIMN 30010
using namespace std;
int n;
int f[4 * DIMN] , gr[4 * DIMN];
vector <pair <int , int> > v[4 * DIMN];
deque <int> dq;
bitset <20 * DIMN> rcs;
void dfs (int nod , int &val){
int i , vecin , cst;
f[nod] = 1;
for (i = 0 ; i < v[nod].size() ; i++){
vecin = v[nod][i].first;
cst = v[nod][i].second;
if (f[vecin])
continue;
if (vecin > 2 * n && vecin <= 3 * n){ /// il bagi in a
val += cst;
}
else if (vecin > 3 * n) { /// il bagi in b
val -= cst;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tug.cpp: In function 'void dfs(int, int&)':
tug.cpp:18:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (i = 0 ; i < v[nod].size() ; i++){
      |                  ~~^~~~~~~~~~~~~~~
tug.cpp: In function 'int main()':
tug.cpp:70:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |         for (i = 0 ; i < v[nod].size() ; i++){
      |                      ~~^~~~~~~~~~~~~~~
tug.cpp:88:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |         for (i = 0 ; i < v[nod].size() ; i++){
      |                      ~~^~~~~~~~~~~~~~~
tug.cpp:43:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   43 |     fscanf (fin,"%d%d",&n,&k);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~
tug.cpp:45:16: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   45 |         fscanf (fin,"%d%d%d",&x,&y,&z);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...