GithubHelp home page GithubHelp logo

nctu-pcca / nctu_tmprry Goto Github PK

View Code? Open in Web Editor NEW
25.0 5.0 3.0 68.65 MB

NCTU_Tmprry, an team for ACM ICPC of Nation Chiao Tung University.

C++ 48.47% C 0.10% HTML 14.62% JavaScript 22.81% CSS 5.60% Python 2.40% TeX 5.82% Shell 0.03% Vim Script 0.08% Makefile 0.08%

nctu_tmprry's Introduction

NCTU_Tmprry

p1

Member

Award

2017

2016

nctu_tmprry's People

Contributors

cthbst avatar yqkqknct avatar ggh93234999 avatar

Stargazers

Hank Chen avatar 3m1p avatar Scott Ssuyi Huang avatar Chia-An Lee avatar Kent avatar  avatar Jasper Lin avatar Yu-Zhe Wang avatar  avatar Jiahao Shi avatar ICEJJ avatar halloworld avatar  avatar  avatar BoHau Huang avatar Allen Lin avatar Chen-hao Chang avatar Luqman A. Siswanto avatar Frank Huang avatar Ting Rui Wang avatar Petingo avatar Beans Hung avatar Steven Lin avatar Ping-yu Chou avatar Chun-Hung Tseng avatar

Watchers

James Cloos avatar  avatar Petingo avatar  avatar  avatar

nctu_tmprry's Issues

Debug SOP

邊界條件 (過程溢位, 題目數據範圍)
是否讀錯題目

Floyd - Negative Cycle Vaildation

#include <bits/stdc++.h>
using namespace std;

const int INF = 1000000;
const int MAXN = 200;
int n, m, q;
int d[MAXN][MAXN];

int main () {
    while ( cin >> n >> m >> q && n) {
        
        for ( int i = 0 ; i <= n ; i++ ) {
            for ( int j = 0 ; j <= n ; j++ ) d[i][j] = (i==j ? 0 : INF);
        }

        for ( int i = 0 ; i < m ; i++ ) {
            int a, b, c;
            cin >> a >> b >> c;
            d[a][b] = min(d[a][b], c);
        }

        for ( int k = 0 ; k < n ; k++ ) {
            for ( int i = 0 ; i < n ; i++ ) {
                for ( int j = 0 ; j < n ; j++ ) {

                    if ( d[i][j] > d[i][k] + d[k][j] && d[i][k] < INF && d[k][j] < INF ) {
                        //printf("%d > %d + %d\n", d[i][j], d[i][k], d[k][j]);
                        //if ( d[i][k] >= INF || d[k][j] >= INF ) cout << "NO : " << i << " " << j << " " << k << "--"; 
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                    }
                }
            }
        }

        for ( int i = 0 ; i < n ; i++ ) {
            for ( int j = 0 ; j < n ; j++ ) {
                for ( int k = 0 ; k < n && d[i][j] != -INF ; k++ ) {
                    if ( d[k][k] < 0 && d[i][k] != INF && d[k][j] != INF  ) 
                        d[i][j] = -INF;
                }
            }
        }
        int u, v;
        for (int i=0;i<q;i++){
            scanf("%d%d",&u,&v);

            if (d[u][v] == INF) printf("Impossible\n");
            else if (d[u][v] == -INF) printf("-Infinity\n");
            else printf("%d\n",d[u][v]);
        }
        puts("");
    }
    return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.