Submission #19183

# Submission time Handle Problem Language Result Execution time Memory
19183 2016-02-19T21:44:18 Z cki86201 Following Flow (kriii1_F) C++
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <time.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

double A[35][35], b[35];
int n, m;
int deg[35], sl[35];
int E[35][35];

int main(){
	scanf("%d%d", &n, &m);
	rep(i, m){
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		deg[x]++;
		E[x][y]++;
		sl[x] += z;
	}
	rep(i, n)b[i] = (double)sl[i] / deg[i], A[i][i] = 1;
	rep(i, n)rep(j, n){
		A[i][j] -= (double)E[i][j] / deg[i];
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			//A[i][j] to 0;
			//A[i] -= x * A[j]
			double x = A[i][j] / A[j][j];
			for(int k=j;k<n;k++)A[i][k] -= x * A[j][k];
			b[i] -= x * b[j];
		}
	}
	for(int i=n-1;i>=0;i--){
		b[i] /= A[i][i];
		for(int j=i-1;j>=0;j--)b[j] -= b[i] * A[j][i];
	}
	printf("%.10f", b[0]);
	return 0;
}

Compilation message

In file included from /usr/include/c++/4.9/unordered_set:35:0,
                 from F.cpp:15:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
F.cpp: In function ‘int main()’:
F.cpp:35:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
                       ^
F.cpp:38:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &x, &y, &z);
                              ^